tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: log4j problem
Date Tue, 13 May 2003 14:48:01 GMT

Howdy,
Jim's advice is consistent with log4j's documentation.  In fact, I like
his approach better, as I don't like relying on default initialization.
With a  small tweak, which is I like to pass the URL from
servletContext.getResource() directory into log4j's
PropertyConfigurator.configure(URL src) call.

WEB-INF/classes is on the classpath: if you place the logj4.properties
file there log4j will pick it up.  Turn on the log4j.debug system
property and check your catalina.out file to see why it isn't being
loaded properly.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: harm@informatiefabriek.nl [mailto:harm@informatiefabriek.nl]
>Sent: Tuesday, May 13, 2003 10:39 AM
>To: Tomcat Users List
>Subject: RE: log4j problem
>
>Jim,
>
>Thanks for your reply. But this comes from the Log4J documentation
which
>suggests otherwise:
>
>-------
>Default Initialization under Tomcat
>The default log4j initialization is particularly useful in web-server
>environments. Under Tomcat 3.x and 4.x, you should place the
>log4j.properties under the WEB-INF/classes directory of your
>web-applications. Log4j will find the properties file and initialize
>itself. This is easy to do and it works. ------
>
>Thanks,
>Harm de Laat
>Informatiefabriek
>The Netherlands
>
>
>
>
>"Collins, Jim" <jim.collins@uk.nomura.com>
>05/13/2003 04:34 PM
>Please respond to
>"Tomcat Users List" <tomcat-user@jakarta.apache.org>
>
>
>To
>'Tomcat Users List' <tomcat-user@jakarta.apache.org>
>cc
>
>Subject
>RE: log4j problem
>
>
>
>
>
>
>Unless you tell log4j where to pick up the log4j.properties it will
search
>the classpath to pick up a log4j.properties file.
>
>Try this to setup log4j:
>
>                 Properties logProp = new Properties();
>
>logProp.load(ActionServlet.getServletContext().getResourceAsStream("/WE
B-
>INF
>/classes/log4j.properties"));
>                 PropertyConfigurator.configure(logProp);
>
>Regards
>
>Jim.
>
>> -----Original Message-----
>> From: harm@informatiefabriek.nl [mailto:harm@informatiefabriek.nl]
>> Sent: 13 May 2003 14:25
>> To: Tomcat Users List
>> Subject: RE: log4j problem
>>
>>
>> Jim,
>>
>> Thanks for your response.
>>
>> The log4j.jar file is located in WEB-INF/lib of my webapplication.
>>
>> I agree with you. I suspect that my properties file is not
>> loaded. But, I
>> don't know why...
>>
>> Do you have any idea?
>>
>> Harm de Laat
>> Informatiefabriek
>> The Netherlands
>>
>>
>>
>>
>> "Collins, Jim" <jim.collins@uk.nomura.com>
>> 05/13/2003 03:00 PM
>> Please respond to
>> "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>>
>>
>> To
>> 'Tomcat Users List' <tomcat-user@jakarta.apache.org>
>> cc
>>
>> Subject
>> RE: log4j problem
>>
>>
>>
>>
>>
>>
>> Where is your log4j.jar file? It looks to me as if your
>> properties file is
>> not getting loaded.
>>
>> Regards
>>
>> Jim.
>>
>> > -----Original Message-----
>> > From: harm@informatiefabriek.nl [mailto:harm@informatiefabriek.nl]
>> > Sent: 13 May 2003 13:57
>> > To: Tomcat Users List
>> > Subject: Re: log4j problem
>> >
>> >
>> > Tim,
>> >
>> > Thanks for your suggestions.
>> >
>> > I'm running Jboss 3.0.6 with integrated Tomcat 4.1.x.
>> >
>> > I watched the console output from the Jboss - tomcat server.
>> > And I don't
>> > see any strange errors or messages when I deploy my web-app.
>> > Also, I'm not using any security managers (not that I'm aware
>> > of anyway).
>> >
>> > Any other ideas?
>> >
>> > Thanks,
>> >
>> > Harm de Laat
>> > Informatiefabriek
>> > The Netherlands
>> >
>> >
>> >
>> >
>> >
>> > Tim Funk <funkman@joedog.org>
>> > 05/13/2003 02:41 PM
>> > Please respond to
>> > "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>> >
>> >
>> > To
>> > Tomcat Users List <tomcat-user@jakarta.apache.org>
>> > cc
>> >
>> > Subject
>> > Re: log4j problem
>> >
>> >
>> >
>> >
>> >
>> >
>> > While I don't know your solution, I was fiddling with log4j
>> > yesterday and
>> > noticed log4j will spew warning messages to standard output when it
>> > encounters problems while reading the log4j.properties.
>> >
>> > Standard output might have some hidden gem.
>> >
>> > Otherwise - are you running any security managers in java? It
>> > might not be
>> >
>> > letting you write to /tmp.
>> >
>> > -Tim
>> >
>> > harm@informatiefabriek.nl wrote:
>> > > Hi all,
>> > >
>> > > I'm trying to use the log4j package in my web appliction.
>> > > I copied log4j.properties into my WEB-INF/classes dir. This file
>> > contains:
>> > >
>> > > log4j.rootLogger=debug, stdout, R
>> > >
>> > > log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>> > > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>> > >
>> > > # Pattern to output the caller's file name and line number.
>> > > log4j.appender.stdout.layout.ConversionPattern=%5p [%t]
>> > (%F:%L) - %m%n
>> > >
>> > > log4j.appender.R=org.apache.log4j.RollingFileAppender
>> > > log4j.appender.R.File=/tmp/blah.log
>> > >
>> > > log4j.appender.R.MaxFileSize=100KB
>> > > # Keep one backup file
>> > > log4j.appender.R.MaxBackupIndex=1
>> > >
>> > > log4j.appender.R.layout=org.apache.log4j.PatternLayout
>> > > log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
>> > >
>> > > In my (struts) ActionClass I call:
>> > >
>> > > // ... other code ...
>> > > Logger log = Logger.getLogger(SendMailAction.class);
>> > > log.info("Test message");
>> > >
>> > > In my Tomcat console I see this message nicely printed:
>> > >
>> > > 14:08:03,472 INFO  [SendMailAction] Test message
>> > >
>> > > But, the log file /tmp/blah.log does not get created!
>> > >
>> > > I have tried a lot of things. My file-permissions are okay.
>> > (I even made
>> >
>> > > /tmp chmod 777).
>> > > This does not make any difference.
>> > >
>> > > Can somebody please tell what is wrong here. I'm realy
>> > stuck at this!
>> > >
>> > > Thanks a million,
>> > >
>> > > Harm de Laat
>> > > Informatiefabriek
>> > > The Netherlands
>> > >
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail:
tomcat-user-help@jakarta.apache.org
>> >
>> >
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail:
tomcat-user-help@jakarta.apache.org
>> >
>>
>>
>> PLEASE READ: The information contained in this email is confidential
>> and intended for the named recipient(s) only. If you are not
>> an intended
>> recipient of this email you must not copy, distribute or take any
>> further action in reliance on it and you should delete it and
>> notify the
>> sender immediately. Email is not a secure method of communication and
>> Nomura International plc cannot accept responsibility for the
accuracy
>> or completeness of this message or any attachment(s). Please
>> examine this
>> email for virus infection, for which Nomura International plc accepts
>> no responsibility. If verification of this email is sought then
please
>> request a hard copy. Unless otherwise stated any views or opinions
>> presented are solely those of the author and do not represent those
of
>> Nomura International plc. This email is intended for informational
>> purposes only and is not a solicitation or offer to buy or sell
>> securities or related financial instruments. Nomura
>> International plc is
>> regulated by the Financial Services Authority and is a member of the
>> London Stock Exchange.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
>
>PLEASE READ: The information contained in this email is confidential
>and intended for the named recipient(s) only. If you are not an
intended
>recipient of this email you must not copy, distribute or take any
>further action in reliance on it and you should delete it and notify
the
>sender immediately. Email is not a secure method of communication and
>Nomura International plc cannot accept responsibility for the accuracy
>or completeness of this message or any attachment(s). Please examine
this
>email for virus infection, for which Nomura International plc accepts
>no responsibility. If verification of this email is sought then please
>request a hard copy. Unless otherwise stated any views or opinions
>presented are solely those of the author and do not represent those of
>Nomura International plc. This email is intended for informational
>purposes only and is not a solicitation or offer to buy or sell
>securities or related financial instruments. Nomura International plc
is
>regulated by the Financial Services Authority and is a member of the
>London Stock Exchange.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message