Understanding Classloaders: log4j in a J2EE Environment
by Vikram Goyal04/02/2003
A previous article of
mine explained the basics of log4j. log4j is an open source logging tool
developed under the Jakarta Apache project. The previous article demonstrated
how to use log4j in a strictly JSP/servlet environment, which forms half of the
whole J2EE world. The other half, EJBs, requires a subtler way of handling your
log4j code and configuration. This article will show you why this is the case
and how to go about it.
Brief Synopsis
log4j is a popular logging tool, as it provides flexible control over logging
and debugging requirements of a Java project. It is hierarchical in nature and
provides runtime control over all aspects of logging without having to change
the source code.
log4j controls logging with three main properties: loggers, appenders, and
layouts. A logger logs to an appender in a particular
layout (style). These can be specified using an external
configuration file, which is the best way of doing so. These configuration
properties are loaded during your application startup and can be changed at
runtime.
The steps involved in using log4j are:
1. Write a configuration file. In this file:
- Specify the level of the root logger and attach an appender to it.
- Specify the properties of the appender.
- Specify a layout for the appender.
2. In your code, acquire a logger by class or name. Typically, this should be the logger associated with the current class.
3. Start logging using any of the methods of the logger you acquired in step 2
(log.debug(), log.info(), log.warn(),
log.error(), log.fatal()).
|
Related Reading
Weblogic Server 6.1 Workbook for Enterprise Java Beans |
Setup
The examples in this article are tested on BEA WebLogic 7.0 SP2 demo
version. The reason for using WebLogic instead of an open source equivalent
like JBoss is because WebLogic provides the hardest challenge in terms of
configuring log4j. It is also the most prevalent application server and the one
for which I received the most requests for help after my previous article.
This setup is by no means the recommended setup for WebLogic. It is only
intended as a testing environment towards configuring log4j in a J2EE
environment for this article.
WebLogic Setup
WebLogic 7.0 SP 2 can be downloaded from BEA's trial page. Select and download the installer with which you are most comfortable. Note that you will need to register with BEA and that the download size may be huge (approximately 150MB). Alternatively, you could ask for a free demo CD to be sent to you.
Once you get hold of the installer, installing WebLogic is a simple process
of answering wizard-style questions. Choose the typical install for this
testing environment. When you reach the end of the install, you will be asked
if you want to configure a domain. Select "yes" to run the domain configuration
wizard. The first screen will ask you to select the domain type and name.
Select WLSDomain as the domain type and leave the name as
mydomain. In the next screen, leave the server type as single
server (standalone server). Use the default location in the next screen for
the domain location. On clicking "next," you will be taken to the standalone
server configuration. Leave all entries as they are and click "next." You will
now need to select a username and password for this domain. I used
admin as the username and password as the password
(Highly original!). Select "No" on the next screen for registering the service
as a Windows service (if you are running this on Windows). Finally, select "Yes"
to placing a shortcut on the Windows Start Menu. The final screen lets you
review everything that you have just done. Clicking the "create" button will
create this domain for you.
To run WebLogic for this domain, go to Start->All Programs->BEA WebLogic Platform 7.0->User Projects->mydomain->Start Server. This simply launches a Windows command file located in your BEA home directory under user_projects\mydomain called startWebLogic.cmd. You will be asked for the username and password that you provided while running the domain configuration wizard. You will know the server is running successfully when you see the message "Server started in running mode." To exit the server, simply close this DOS window.
Once your server is running successfully, fire up a browser window and navigate to http://localhost:7001/console. This will bring up the console window from where you can install and configure the applications to run on this server. You will be asked for your username and password, as before. Once you are in, you will see various administrative tasks that you can perform.
log4j Setup
As mentioned before, log4j can be downloaded from the log4j web site. Please refer to the previous article on how to download and install the log4j
binaries. We will leave the configuration of log4j until later in this
chapter.
Why is It Different? The Concept of Classloaders
Although a full and thorough discussion on classloaders is outside of the scope
of this article, I will try and explain what classloaders are and how they
impact our configuration of log4j in an application server.
Classloaders, as the name suggests, are responsible for loading classes within the JVM. Before your class can be executed or accessed, it must become available via a classloader. Given a class name, a classloader locates the class and loads it into the JVM. Classloaders are Java classes themselves. This brings the question: if classloaders are Java classes themselves, who or what loads them?
When you execute a Java program (i.e., by typing java at a
command prompt), it executes and launches a native Java launcher. By native, I
mean native to your current platform and environment. This native Java
launcher contains a classloader called the bootstrap classloader. This
bootstrap classloader is native to your environment and is not written
in Java. The main function of the bootstrap classloader is to load the core
Java classes.

Figure 1; Classloader delegation hierarchy
The JVM implements two other classloaders by default. The bootstrap
classloader loads the extension and application classloaders into memory. Both
are written in Java. As mentioned before, the bootstrap classloader loads the
core Java classes (for example, classes from the java.util
package). The extension classloader loads classes that extend the core Java
classes (e.g., classes from the javax
packages, or the classes under the ext directory of your runtime).
The application classloader loads the classes that make up your
application.
All three default classloaders follow the delegation model. Before a child classloader tries to locate a class, it delegates that task to a parent. When your application requests a particular class, the application classloader delegates this request to the extension classloader, which in turn delegates it to the bootstrap classloader. If the class that you requested is a Java core class, the bootstrap classloader will make the class available to you. However, if it cannot find the class, the request returns to the extension classloader, and from there to the application classloader itself. The idea is that each classloader first looks up to its parent for a particular class. Only if the parent does not have the class does the child classloader try to look it up itself.
In application servers, each separately-deployed web application and EJB gets its own classloader (normally; this is certainly the case in WebLogic). This classloader is derived from the application classloader and is responsible for that particular EJB or web application. (Note that if an application is deployed as an EAR file--a combination of EJB and webapps--it gets one classloader, no more). This new classloader loads all classes that the webapp or EJB require that are not already part the Java core classes or the extension packages. It is also responsible for loading and unloading of classes, a feature missing from the default classloaders. This feature helps in hot deploy of applications.
When WebLogic starts up, it uses the Java-supplied application classloader to load the classes that make up its runtime. It then launches individual classloaders, derived from the Java application classloader, which load the classes for individual applications. The individual classloaders are invisible to the classloaders of the other applications; hence, classes loaded for one particular application will not be seen by another application.

Figure 2: Individual application classloaders
What if you want to make a single class available to all applications? Load it in a top-level classloader. This could be in the classpath of WebLogic. When WebLogic starts, it will automatically load this class in memory using the Java-supplied application classloader. All sub-application classloaders get access to it. However, the negatives of this approach are clear too. First, you lose the capability of hot deploy for this particular class in all individual applications. Second, any change in this class means that the server needs to be restarted, as there is no mechanism for a Java application classloader to reload classes. You will need to weigh in the pros and cons before you take this approach.
log4j is an external library to your J2EE application. Where do you store
this library? As mentioned in the previous paragraph, one option is in the
WebLogic startup classpath. However, this seems to be an easy way out, and is
not recommended for the reasons stated earlier. Configuration of log4j in a
J2EE environment is different because EJBs don't see the classes loaded by a
relevant webapp--EJBs are loaded by a different classloader! This is the
general case, unless you package your application to use the same classloader for loading your EJB as well as the webapp. I will illustrate this concept with
some examples.
|
Source Code • Log4JDemo-EJB-src.zip |
We will start with deploying the original webapp from the previous article along with an EJB and a JSP that exercises this EJB in our newly-configured WebLogic server. The EJB is a very simple EJB, containing an even simpler method that returns "Hello World" when invoked.
Example: Why Doesn't It Work?
Deploy the updated .war file and then the EJB .jar file for this example using the WebLogic console. When you try to install the EJB .jar file, you will get an error stating
that the org.apache.log4j.Logger classes cannot be found.
The EJB .jar file has no knowledge about the log4j classes in the
WEB-INF directory of the corresponding webapp, as the EJB and webapp use different classloaders. Even if you combine these two into an .ear file and try to deploy it, you will still get
the same error message. Why? Even though there is only one classloader for the
.ear file and it theoretically should be loaded when you deploy, we have not
told our EJB where to access the log4j.jar files.
Example: Why It Will Work
Here is an updated .ear file with a working example. Let me list the changes to make this example work:
- I moved the log4j.jar file from the webapp's lib directory into a top-level directory. This gives the .jar file the EJB's visibility.
- I modified the Manifest.mf for the EJB .jar to contain an entry
for
Classpath, pointing to log4j.jar.
These changes are enough to make this .ear file deployable in WebLogic. When
you deploy this application using the console, you will not get any errors,
because our EJB now has access to the log4j classes. There is only one
classloader for the Log4JDemoEAR2 application. It is responsible for loading
the libraries and classes for this application as a whole. The
Classpath entry for the EJB is used to resolve dependencies and
load log4j.jar. The webapp still has access to this library, even
after moving it out of lib, as we use the same classloader!
Strategy For a J2EE Environment
Depending on your requirements, I suggest the following strategy. You will
realize that it is not just relevant for log4j, but to any external utility
classes that your application might require.
- If the utility class is required only by your web application, keep it under the WEB-INF/lib directory.
- If it is required by both your web application and your EJB(s), make an
entry in your manifest file for the EJB and specify all of the utility classes on
the
Classpathentry. Keep this utility file either at the top level or under a top-level directory in your .ear file. This way, all of your EJBs and .war files will have visibility to this utility class without you needing to duplicate it.
Conclusion
J2EE packaging can be quite tiresome if you are not clear on how classloading works. A good understanding of this "under the hood" mechanism is critical to deploying your J2EE applications successfully. It helps to have a deployment engineer specifically geared towards this task.
log4j works seamlessly in both aspects of a J2EE application. It just has to
be configured correctly. I hope this article has shown you the correct way.
Resources
- Tyler Jewell's commentary on EJB 2 and J2EE packaging explains this strategy in more detail.
- IBM has published a document on Websphere-specific Classloader issues.
- WebLogic's classloader architecture can be accessed here.
- Some information on
log4jand classloader issues can be found in thelog4jtroubleshooting docs.
Vikram Goyal is the author of Pro Java ME MMAPI.
Return to ONJava.com.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 35 of 35.
-
Very good article.
2006-09-20 17:04:16 prope//er [Reply | View]
First of all, thanks for writing the article and being focussed enough to take criticism. I think this article is relevant as it talks about configuring Log4J and the issues surrounding the packaging and deployment on application servers.
anonymous2 (?) was commenting on how this was not about Application Servers or Log4J or clustering. I guess he us missing the point of the article. The intent of the article was not to discuss clustering or application servers but to explain how classloaders effect logging with Log4J.
later
//
-
Using Log4J in a JCA 1.5 compliant resource adapter
2006-09-12 15:37:10 jmrengifo [Reply | View]
Hi,
First of all, thank you for your article...
I have developed a JCA 1.5 connector, and decided to use log4j as logging framework in my Sun Java System Application Server instance.
I have tried to follow your instructions, but the only way I have made this work is by copying log4j jar file into myDomainPath/lib/ext directory and my log4j.xml configuration file into myDomainPath/config directory which I guess is the AS classloader.
-
Where to place the Log4j .properties file
2004-08-20 15:48:55 Aravind [Reply | View]
I tried to place the log4j.props in at ther EAR level but for some reason Log4j is not able to find the file? Pls let meknow where to place this props file so that log4j can find it!
-
What about different JVMs
2004-03-06 13:49:29 hminocha [Reply | View]
Hi Vikram,
I am just evaluating use log4j for our J2EE applications.
Your article discusses, how to overcome problems if the WEB and EJB are in different classloaders.
But an app server may also have the web container and ejb container in different JVMs.
Then the initialization, you do in the servlet is not reflected in the EJB container. Any tips on how to initialize log4j in a EJB container (and also be somehow use configureAndWatch(), since EJB specs prohibit starting your threads).
Regards,
Hemant
-
Manifest.mf questions
2003-12-23 00:30:50 anonymous2 [Reply | View]
HI,
In your article, it say:
======
I modified the Manifest.mf for the EJB .jar to contain an entry for Classpath, pointing to log4j.jar
=========
But i did not find out any different between
Log4JDemoEAR.ear and Log4JDemoEAR2
and i can't find the point to log4j.jar
Why?
Sincerely
founder_chen
Open Source Middleware Community
www.huihoo.org
-
Manifest.mf question
2003-12-23 00:30:44 anonymous2 [Reply | View]
HI,
In your article, it say:
======
I modified the Manifest.mf for the EJB .jar to contain an entry for Classpath, pointing to log4j.jar
=========
But i did not find out any different between
Log4JDemoEAR.ear and Log4JDemoEAR2
and i can't find the point to log4j.jar
Why?
Sincerely
founder_chen
Open Source Middleware Community
www.huihoo.org
-
junit / websphere
2003-10-13 11:19:54 ray.case [Reply | View]
I can't get JUnit and WebSphere to work with log4j at the same time. WebSphere adds its own cr to anything going to system.out. JUnit suffers without a '\n' if you leave it out and WebSphere has two '\n' for each line if you add a '\n' to the console appender for JUnit. any ideas? anyone? ahhhhhh!!!
Ray
-
file io from an ejb
2003-09-22 06:15:12 anonymous2 [Reply | View]
I thought you weren't supposed to do file IO from within an EJB? So how do you read in you log4j properties file? How can you log to a file?
-
configuration file?
2003-07-18 05:25:55 tdennison [Reply | View]
This article was helpful, but I still am left wondering where I should locate the log4j.properties file if my WAR and ejb-jar classes utilize log4j. Can someone shed some light on this issue? -
configuration file?
2003-09-08 02:45:42 anonymous2 [Reply | View]
You have 2 options:
1. put it in web-inf/classes, if only web components use log4j
2. put it in .ear root if web and ejbs use it. in this case, classpath entry in manifest files of web and ejb jar has to point to your properties file.
-
Using common libraries in an hot-deployment environment
2003-06-23 13:20:16 stef_84 [Reply | View]
...good article putting all the things in the correct way.
Still, one question remains open for me (and actually is an issue in the project I am working in...): Using common libraries (as log4j in your example) in an hot-deployment-environment.
By "hot-deployment-environment" I am not talking about hot-deploying an .ear-file (copy it over to the BEA-dir and it will be deployed without restarting the app-server). I am talking about the hot-deployment of all parts of your web-app, respectivly JSP's, classes and property-files. Therefor you have to deploy your web-app as an "exploded directory", meaning forget about the .war-file and copy over a "normal" directory-structure.
If your web-app is still accessing some EJB-layer, then you could deploy this one as an .ear file. From this moment on (as described in the article) you got two applications with two different class-loaders.
This means for all common libraries: They have to be known to the web-app (/WEB-INF/lib) as well as in the .ear file, meaning they have to be redundantly in both structures. Is that correct or is there any other way around?
The consequence for the overall deployment-process is that we have two different approaches with two different build-scripts: one for hot-deployment and one for the "final" build that kicks out one big .ear-file including the .war and the ejb-layer.
Why is BEA not behaving let's say like JBoss and unpacking the .ear file to an exploding directory-structure therefor allowing it at a later point to exchange classes, JSP's or whatever?
Hints, comments welcome.
Greetings, Stefan
-
Excellent Article
2003-05-22 08:22:46 anonymous2 [Reply | View]
I got a clear understanding of the "role" classloaders play in J2EE environment.
-
Properties file
2003-04-25 01:19:36 anonymous2 [Reply | View]
This is a very useful article; but unfortunatelly it doesn't mention anything about using properties file in a j2ee application, which is a big issue for me in this moment.
Where do I have to put my "log4j.xml" file in order to be found?
-
threads in EJB ?
2003-04-16 05:16:47 anonymous2 [Reply | View]
I am using Log4J in my EJB as per your article.
Well now i have a serious issue that EJB specs says not to use threads but Log4J use thread to log into file system. So log4j is it not violating the specs when used inside my EJB ?
plaese reply to me to my mail id srinath@dwp.net
regards
Sreenath.V -
threads in EJB ?
2003-11-16 21:35:22 anonymous2 [Reply | View]
u mean to say the container handles the threading concepts for the iterations in the process. -
threads in EJB ?
2003-06-18 09:04:22 bclayabt [Reply | View]
The issue of threads as they relate to EJB’s can be confusing. Actually, the specification reads: The enterprise bean must not attempt to manage threads…. It would be impossible to guarantee that every 3rd party library an application utilizes does no thread management. The spirit of this restriction boils down to two issues: risks of reentrancy, and the container’s overall ability to control the runtime environment. If an EJB creates a thread, and that thread executes code that results in the creation of other EJB instances, or passes through code that the container expects to have full control over, it can (and probably will) compromise the container’s ability to manage concurrency issues and other things. This is a form of reentrancy.
Secondarily, when a thread is spawned, the container has no way of terminating the thread and/or freeing the resources held by that thread when it chooses to passivate or remove an EJB. The argument could be made that the lifecycle methods could be used to manage the thread, but there is almost always a better solution to the underlying problem that the application is trying to solve. Specifically, solutions that press the envelope on threading in this way can often be better solved using some sort of JCA approach to manage the resource they would otherwise attempt to manage using the thread.
When it comes to Log4J and other libraries that utilize threads to perform internal housekeeping, my experience has been that they pose no problems. These threads don’t touch any other runtime artifacts that could introduce reentrancy, and they don’t compromise the container’s ability to manage the runtime environment.
-
this is not an o'reilly quality article
2003-04-10 21:55:40 anonymous2 [Reply | View]
i get the feeling this article wasn't proofread by anyone that really writes java. -
this is not an o'reilly quality article
2003-04-15 02:36:45 anonymous2 [Reply | View]
I do not know what is O'Reilly Quality sepcifications. But I did not understand the purpose of writing this article. If it is regarding class-loaders, the author says, it is big topic, and is outside the scope. If it is regarding J2EE-log4j integration, I think not even 20% of the issues of log4j in J2EE application are discussed (Clustering, Multiple weblogic instances on single machine, EJB and web app deployed separate etc. etc) More than 30% of the text is on setup of weblogic-log4j. The author has given a link to Weblogic class-loader mechanism, which is very much self explanatory.
So please anybody tell me what is this article for ???
-
this is not an o'reilly quality article
2003-04-17 20:41:07 gvix [Reply | View]
Hello,
The intent of the article was to specify the classloading problems for log4j integration in a J2EE environment. It was neither solely about classloaders nor solely about log4j in a J2EE environment. It was addressing a specific problem.
Regards,
Vikram Goyal
-
At first sight I agree, but.......
2003-04-08 10:46:30 anonymous2 [Reply | View]
I'm not sure putting the log4j in the .ear file is always the best solution. It seems the obvious thing to do as all the code for your app is in one location.
My problem is to do with the configuration of Log4j and not the classloading. If the config file is also in the .ear then it is pretty much impossible to change the logging config at runtime without re-deploying the application. You can't take advantage of methods like DOMConfigurator.prepareAndWatch(...) as you can't change the xml config file. It's hidden in the ear file.
Another issue is if you wish to initialise log4j yourself and not rely on the default initialisation. Where should you put the code for this one time initialisation? Certainly not in an EJB method.
How have people resolved these issues?
-
At first sight I agree, but.......
2003-04-11 05:30:55 gvix [Reply | View]
Hello,
Thanks for the feedback.
You are correct. When you deploy it as an ear file, you lose the ability to change it at runtime. Having said that, you can still configure it at runtime by providing a runtime interface to the log4j API. Remember, log4j can be reconfigured using direct calls to the API. I have myself not tried this, but I believe it can be done. I am also not sure if you can do the same with the exploded format. I would love to hear from somebody who has tried this.
As regards your second issue, if you application has a web part, you can use a startup servlet. If not, you can use a static class that does the initialization for you.
Hope this helps,
Vikram Goyal
-
At first sight I agree, but.......
2003-04-15 04:23:46 anonymous2 [Reply | View]
I have managed to get Log4J to be configurable at runtime by setting the system propertylog4j.configuratorClass. This property is used by Log4J to specify the configurator class used during the default initialisation. We then wrote a configurator to allow Log4J to watch the config file for updates.
This method works fine, but it does mean that this configurator is used for all applications using Log4J on that server. This in turn implies that you have one configuration file for each server (i.e. it applies to all the apps running on that server).
Whilst it would be nice to separate the logging configuration for each app on a j2ee server, in practise it's not that bad. Our support administrators like to configure logging on a per server basis anyway.
-
How about utility.jar for multiple EARs?
2003-04-07 03:22:50 anonymous2 [Reply | View]
If I have a common jar for multplie EARs, for example, I don't want everyone to pack his own version of log4j, what can i do? -
How about utility.jar for multiple EARs?
2003-04-11 05:18:51 gvix [Reply | View]
Hello,
I am not sure if I understand you question.
Based on what I think you are asking, I would suggest that if you have a jar that a host of other EAR's require, deploy it on the system classpath. The idea is, that if it a system wide utility library, a change in this library would have an effect system wide. It's almost equivalent to a change in Weblogic classes. Your server will need to be restarted and I think if it is system wide, you might as well put it on the Weblogic classpath.
Regards,
Vikram Goyal
-
You still haven't addressed the most important thing....
2003-04-04 10:11:58 anonymous2 [Reply | View]
Which hardly anybody addresses - which is how to use it in a cluster. What's the point in explaining how to do it on a single server.
I guess the main reason nobody tells how to do it is because log4j is an infant - it has no cluster support. Far better to stuff log4j away until it becomes mature, and use WEbLogic's superior logging.
-
You still haven't addressed the most important thing....
2003-04-11 05:09:34 gvix [Reply | View]
Hello,
Thanks for the feedback.
The articles main idea was to understand classloading issues and not act as a manual for all the issues involved in J2EE packaging and deployment.
I agree that log4j in a cluster is an issue. However, it can be addressed by using either SocketAppender or JMX.
I disagree when you say that log4j is not mature. There needs to be more to substantiate that claim than lack of genuine cluster support.
Regards,
Vikram Goyal -
log4j in a cluster is an issue?
2003-04-18 11:10:45 anonymous2 [Reply | View]
Hello Vikram,
I have enjoyed both of your articles. I am new to log4j and researching it for use across my company's applications.
We are running WebLogic clustered, so I am wondering what you mean when you say "I agree that log4j in a cluster is an issue"? What are the issues related to clustering??
Thanks,
- darryl -
log4j in a cluster is an issue?
2003-04-21 21:55:18 gvix [Reply | View]
Hi Darryl,
Log4J in a cluster is an issue if you are using FileAppender. The problem arises because of multiple process from multiple machines writing to the same file. Either you need to synchronize these processes by writing a buffer around the FileAppender or use some other appender like the SocketAppender or the JMSAppender.
Best Regards,
Vikram Goyal -
You still haven't addressed the most important thing....
2003-04-17 07:53:07 anonymous2 [Reply | View]
Vikram,
This was a good topic to cover, thanks, classloading for J2EE is a constant source of troubles and frustrations and any clarifications are appreciated. I'd like to see a chapter or entire book written on the best way to organize classes in a J2EE app.
I must agree with the original point in this thread. Logging should be provided by J2EE as an app server service.
My recommendation would be to log using your own api (abstract factory pattern) which can then be implemented to use either the app severs logging capabilities, or log4j, or the jdk 1.4 logging. An example of why this would be useful would be log4j's own fickleness in it's api. First it was "Category" and now it's "Logger". It would be nice if they'd just make up their minds, but if you placed a protective layer between your app and logging implementation, you can update to the latest version by changing "category" to "logger" in one file.
BTW: What we need is logging that knows which class it's in without the developer having to specify it. Taking the classloading and that together, log4j is sometimes more trouble than it's worth.
Taylor
-
You still haven't addressed the most important thing....
2003-04-17 20:29:02 gvix [Reply | View]
Hi Taylor,
Thanks for the feedback.
"My recommendation would be to log using your own api (abstract factory pattern) which can then be implemented to use either the app severs logging capabilities, or log4j, or the jdk 1.4 logging. "
You raise an interesting point. If you are familiar with the commons-logging package, then you would realise that what you have suggested has been already put into place by the wise men at Jakarta. It serves the exact purpose that you are referring to above.
" BTW: What we need is logging that knows which class it's in without the developer having to specify it. "
What you say here is a good idea. However, it is against the log4j's idea of flexibility. Loggers need not be specified on a per class basis. The whole idea of Logger naming is to let the developers use whatever logging nomenclature they think is best for them. If we restrict it to per class we are removing this flexibility. I have used a different naming convention in at least one previous project and found it quite useful. Further you may want more than one logger in your class to represent different types of logging. Having one Logger with the default name of the class would defeat the purpose.
Regards,
Vikram
-
Event Logging useing LOG4J
2005-08-05 06:38:41 S.SINGH [Reply | View]
Hi Vikram,
From Architecture point of view what could be the best practices to Log4J. What are diffrent norms we should follow to acheive architectural goal (Performance /scaling, etc)
How Log4j (Appender)writes event messages to a log file ? It collects certain meessage in buffer and then write in one I/O ?? or For every even log it make one I/O ??
How we can minimise the I/O calss ??
Regards,
SS





The article is really nice. Seems you have really worked a lot on log4j. I am new to it. I am developing a hosted service which contains 2 different .war files. I am trying to log the details to a log file, using a .properties file. I have placed this file into the WEB-INF->classes directory.
But yet, after I run the project, the log file is not getting created, the logs are going into the server.log file of JBOSS. I think this problem has something to do with the class loaders. As JBOSS also has its own log4j.jar. Can you please give me a solution to it.
Thanks and Regards
Sneha