Log4j, by default, uses a single logger repository. So, unless you log within the context of your own custom logger repository, the last entity to configure log4j will have configured log4j for every app using the default logger repository. This is not usually a concern in a standalone app, but in a container such as Websphere, you will have to take precautions in order to keep your app's logging configuration separate from others in the container. There are a couple ways to do this...

1. Put log4j in the WEB-INF/lib of each application. Since each webapp should have its own classloader that other apps can't see (nor should the container be able to see it based on Sun's classloader heirarchy rules), the default logger repository is, essentially, reserved for use by your application alone.

2. Use a custom logger repository selector to create a distinct logger repository for your application. This allows for log4j to be in a global classloader that can be seen by all apps (and/or the container as well), but still provide a distinct logging environment for each application. To do this, you will need to utilize an implementation of a logger repository selector; two of which exist in the log4j-sandbox project.

See:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/UsefulCode

specifically the links for the custom repository selectors and servlet stuff.
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/selector/
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/

Take a look at the InitContextListener to utilize the repository selectors in a webapp...
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/InitContextListener.java


The javadoc in that is pretty extensive and should show you how to use everything.

You can check out the latest CVS.  See instructions here:
http://jakarta.apache.org/site/cvsindex.html


Also see: http://cvs.apache.org/viewcvs/jakarta-tomcat/proposals/Log4jHelper/

which is a separate logger repository implementation implemented for Tomcat-3.3.x. Not yet for 5.x.x and probably won't be for 4.1.x.

Jake




At 01:31 PM 6/24/2003 -0700, you wrote:
> Are you sure you don't have a console appender
> defined as well?
yeah i am sure about that.

> Are you
> sure log4j is configured well, i.e. without errors?
will check that in the morning (am at home right now)

> Are you running
> within a container that's also using log4j?
Websphere Application Server 4.0 (not quite sure about
the version number, but i think it is.)
Does Websphere use log4J, i don't know...

thank you.
ruud.

--- "Shapira, Yoav" <[EMAIL PROTECTED]> wrote:
>
> Howdy,
> Are you sure you don't have a console appender
> defined as well?  Are you
> sure log4j is configured well, i.e. without errors?
> Are you running
> within a container that's also using log4j?
>
> Yoav Shapira
> Millennium ChemInformatics
>
>
> >-----Original Message-----
> >From: Ruud Steeghs [mailto:[EMAIL PROTECTED]
> >Sent: Tuesday, June 24, 2003 3:38 PM
> >To: [EMAIL PROTECTED]
> >Subject: RollingFileAppender logs to console, why?
> >
> >Hi,
> >
> >I've configured log4j to log to a
> RollingFileAppender.
> >However, it also logs to console. This is something
> I
> >do not want.
> >Anyone has any idea how to prevent log4j from
> logging
> >to the console as well?
> >
> >regards,
> >Ruud.
> >
> >__________________________________
> >Do you Yahoo!?
> >SBC Yahoo! DSL - Now only $29.95 per month!
> >http://sbc.yahoo.com
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
>
>
> This e-mail, including any attachments, is a
> confidential business communication, and may contain
> information that is confidential, proprietary and/or
> privileged.  This e-mail is intended only for the
> individual(s) to whom it is addressed, and may not
> be saved, copied, printed, disclosed or used by
> anyone else.  If you are not the(an) intended
> recipient, please immediately delete this e-mail
> from your computer system and notify the sender.
> Thank you.
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>


__________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to