commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jasmin Mehta <>
Subject [Logging] : Logs populating in the same file for 2 web applications on OC4J
Date Thu, 12 Aug 2010 14:29:55 GMT

I could write up log4j.xml and implement RepositorySelector  as you 
suggested in the URL. 

But still my logs are going to the same log file for 2 web applications 
deployed on the same OC4J instance.

I have OC4J Application server where I have deployed 2 web 
applications on the same instance, and the logs for both applications are 
going to only one log file which got deployed first. 

log4j-1.2.16.jar is in use as a shared-lib for the instance.

How can I separate them?


From:   Jasmin Mehta/VAB/HQ/NEXNET
To:     "Commons Users List" <>
Date:   08/11/2010 04:10 PM
Subject:        Re: [Logging] : Can commons.logging be used without log4j


I am using instead of log4j.xml. 

Will RepositorySelector  concept still work? What changes I should make 
into this method?

   private static void loadLog4JConfig(ServletConfig config,
                                       Hierarchy hierarchy)
                                            throws ServletException {
        try {
            String log4jFile = "/WEB-INF/log4j.xml";
            InputStream log4JConfig =
            Document doc = DocumentBuilderFactory.newInstance()
            DOMConfigurator conf = new DOMConfigurator();
            conf.doConfigure(doc.getDocumentElement(), hierarchy);
        } catch (Exception e) {
            throw new ServletException(e);

From:   Brent Worden <>
Date:   08/09/2010 09:56 AM
Subject:        Re: [Logging] : Can commons.logging be used without log4j

On 8/9/2010 7:53 AM, Jasmin Mehta wrote:
> The log4j has limitation that if its used as a shared library then it 
> initiate only one configuration. So my all we applications which shares
> the same instance are populating the logs into only one log file (the 
> app which deployed first in order), rather than individual / separate 
> files configured in the path of each of the application's
This isn't true.  Log4j allows for defining and using multiple log
configurations in a single JVM.  This is accomplished by using a
RepositorySelector to manage the multiple log hierarchies.  See for a web
container example.


Brent Worden

To unsubscribe, e-mail:
For additional commands, e-mail:

This email and any files transmitted with it are intended solely for 
the use of the individual or agency to whom they are addressed. 
If you have received this email in error please notify the Navy 
Exchange Service Command e-mail administrator. This footnote 
also confirms that this email message has been scanned for the
presence of computer viruses.

Thank You!            

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message