You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vihari Piratla <vi...@gmail.com> on 2013/03/01 05:58:20 UTC

Re: Problem with log level in tomcat.

@Konstantin Kolinko Sorry I did not observe this, I was talking about the
global one previously, here is the webapp specific one in the attachment
that is log4j.properties.
Now to log at fine level, which line should I change or which line to
append?
Thank you.


On Thu, Feb 28, 2013 at 8:08 PM, Mark Thomas <ma...@apache.org> wrote:

> On 28/02/2013 06:29, André Warnier wrote:
>
>  Konstantin,
>> (and I fear that this is going to raise hackles again, but I think it
>> needs to be said)
>> the truth of the matter is that the logging setup in Tomcat is obscure,
>> cryptic, and in any case beyond the comprehension of 90% at least of the
>> Tomcat users at large.
>> I am willing to take a bet that 90% or more of the Tomcat installations
>> worldwide just leave it alone as it comes, for fear of breaking it, and
>> just "fix" it with scripts outside of Tomcat.
>> So, it is really no wonder that a user would be puzzled as to how this
>> stuff works and how to simply get a logfile out of his app.
>> Or how to simply get Tomcat to write /one/ logfile somewhere, with no
>> daily rotation, with everything in it, and just have it rotated as need
>> by an outside logrotate, as is done for 99% of daemon programs under
>> Unix/Linux.
>>
>
> Patches to the docs / configuration / implementation welcome.
>
> Mark
>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<us...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Vihari Piratla.
students.iitmandi.ac.in/~p_vihari
*"If you can dream it, You can make it"*

Re: Problem with log level in tomcat.

Posted by Vihari Piratla <vi...@gmail.com>.
and also I have log4j-1.2.15.jar in WEB-INF/lib.


On Fri, Mar 1, 2013 at 12:45 PM, Vihari Piratla <vi...@gmail.com>wrote:

> Christopher,
> Please find the pasted properties file.
> I did perform any of the steps that I am supposed if I got to use log4j,
> but it still create muse(name of my web-app).log in /tmp directory with a
> message like this in catalina.out.
> 01 Mar 12:28 Log4JUtils INFO  - Log messages will be recorded in
> /tmp/tomcat7-tomcat7-tmp/muse.log
> True that I am using log4j not juli in the webapp. This is how I am
> getting the handle in the class files.
> public static Log log = LogFactory.getLog(Crossword.class);
>
> This is the log4j.properties file in the WEBINF/classes folder of the
> webapp.
> I tried few things like appending the line log4j.logger=debug with no
> avail.
> # For the general syntax of property based configuration files see the
> # documentation of org.apache.log4j.PropertyConfigurator.
>
> # The root category uses the appender called A1. Since no priority is
> # specified, the root category assumes the default priority for root
> # which is DEBUG in log4j. The root category is the only category that
> # has a default priority. All other categories need not be assigned a
> # priority in which case they inherit their priority from the
> # hierarchy.
>
> log4j.rootCategory=INFO, Console
>
> log4j.logger.com.opensymphony.xwork2=INFO
> log4j.logger.freemarker.cache=INFO
> log4j.logger.org.apache.struts2=INFO
> log4j.logger.org.apache.xml.security=INFO
> log4j.logger.org.apache.commons.httpclient=INFO
> log4j.logger.org.mortbay.log=INFO
> log4j.logger.net.sf.ehcache=OFF
>
>
> #log4j.logger.com.hp.hpl.jena.tdb.base.block.BlockMgrMapped=ERROR, ROOT
>
> # A1 is set to be a LF5Appender which outputs to a swing
> # logging console.
>
> # this is now done programmatically in JSPHelper
> # log4j.appender.ROOT=org.apache.log4j.RollingFileAppender
> # log4j.appender.ROOT.encoding=UTF-8
> # log4j.appender.ROOT.MaxFileSize=5000KB
> # log4j.appender.ROOT.File=muse.log
> # Keep old files around
> # log4j.appender.ROOT.MaxBackupIndex=2
> # log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
> # log4j.appender.ROOT.layout.ConversionPattern=%d{dd MMM HH:mm} %c{1} %-5p
> - %m%n
>
> log4j.appender.Console=org.apache.log4j.ConsoleAppender
> log4j.appender.Console.encoding=UTF-8
> log4j.appender.Console.layout=org.apache.log4j.PatternLayout
> log4j.appender.Console.layout.ConversionPattern=%d{dd MMM HH:mm} %c{1}
> %-5p - %m%n
>
> #log4j.logger.org.apache.jcs=ERROR
> #log4j.logger.net.fortuna.mstor=ERROR
> #log4j.logger.fuse=DEBUG
> #log4j.logger.org.hibernate.SQL=DEBUG
> #log4j.logger.org.hibernate=DEBUG
> #log4j.additivity.org.hibernate.SQL=false
>
>
>
> On Fri, Mar 1, 2013 at 12:32 PM, Christopher Schultz <
> chris@christopherschultz.net> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> Vihari,
>>
>> On 2/28/13 8:58 PM, Vihari Piratla wrote:
>> > @Konstantin Kolinko Sorry I did not observe this, I was talking
>> > about the global one previously, here is the webapp specific one in
>> > the attachment that is log4j.properties.
>>
>> This list tends to strip attachments from posts. Please re-post with
>> your configuration file.
>>
>> I see you said log4j.properties above... until now, you gave us the
>> impression that you were using JULI (which is the default: using log4j
>> with Tomcat at the server-level takes some work). Are you trying to
>> use log4j or was that a typo?
>>
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
>> Comment: GPGTools - http://gpgtools.org
>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>
>> iEYEAREIAAYFAlEwUn4ACgkQ9CaO5/Lv0PDErQCeJ+v9JS5sQPCCMmXJ/iiqihsc
>> JKgAoKYEaZZvTBji26GjEtGOrXQZsKMw
>> =yudQ
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> --
> Vihari Piratla.
> students.iitmandi.ac.in/~p_vihari
> *"If you can dream it, You can make it"*
>



-- 
Vihari Piratla.
students.iitmandi.ac.in/~p_vihari
*"If you can dream it, You can make it"*

Re: Problem with log level in tomcat.

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Vihari,

On 3/1/13 2:15 AM, Vihari Piratla wrote:
> I did perform any of the steps that I am supposed if I got to use
> log4j

Do you mean that you *did* configure Tomcat for log4j, or that you
didn't? If you did, what does the Tomcat (global) log4j.properties
file look like? The one you posted was clearly intended to be used
only with your web application.

Okay, let's start over again. I *think* this is your environment:

1. Tomcat configured to use log4j
2. Your webapp is written to use Apache commons-logging
2. Your webapp configured to use log4j
3. Your webapp's log4j sends everything to the ConsoleLogger (stdout)

#1 above implies that modifying Tomcat's conf/logging.properties file
will not affect anything.

> but it still create muse(name of my web-app).log in /tmp directory 
> with a message like this in catalina.out:
> 
> 01 Mar 12:28 Log4JUtils INFO  - Log messages will be recorded in 
> /tmp/tomcat7-tomcat7-tmp/muse.log

Is Log4JUtils a class of yours? How does it know the path to the log file?

> True that I am using log4j not juli in the webapp. This is how I am
> getting the handle in the class files. public static Log log =
> LogFactory.getLog(Crossword.class);

So you are using commons-logging in your code. Have you provided any
special configuration to commons-logging, or are you allowing it to
auto-detect that log4j is your real logging mechanism?

> This is the log4j.properties file in the WEBINF/classes folder of
> the webapp. I tried few things like appending the line
> log4j.logger=debug with no avail.

I think you meant log4j.debug=true, and that might have to be a system
property. Try setting it in log4j.properties to see what happens.

> # For the general syntax of property based configuration files see
> the # documentation of org.apache.log4j.PropertyConfigurator.
> 
> # The root category uses the appender called A1. Since no priority
> is # specified, the root category assumes the default priority for
> root # which is DEBUG in log4j. The root category is the only
> category that # has a default priority. All other categories need
> not be assigned a # priority in which case they inherit their
> priority from the # hierarchy.
> 
> log4j.rootCategory=INFO, Console
> 
> log4j.logger.com.opensymphony.xwork2=INFO 
> log4j.logger.freemarker.cache=INFO 
> log4j.logger.org.apache.struts2=INFO 
> log4j.logger.org.apache.xml.security=INFO 
> log4j.logger.org.apache.commons.httpclient=INFO 
> log4j.logger.org.mortbay.log=INFO log4j.logger.net.sf.ehcache=OFF
> 
> 
> #log4j.logger.com.hp.hpl.jena.tdb.base.block.BlockMgrMapped=ERROR,
> ROOT
> 
> # A1 is set to be a LF5Appender which outputs to a swing # logging
> console.
> 
> # this is now done programmatically in JSPHelper #
> log4j.appender.ROOT=org.apache.log4j.RollingFileAppender #
> log4j.appender.ROOT.encoding=UTF-8 #
> log4j.appender.ROOT.MaxFileSize=5000KB #
> log4j.appender.ROOT.File=muse.log # Keep old files around #
> log4j.appender.ROOT.MaxBackupIndex=2 #
> log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout #
> log4j.appender.ROOT.layout.ConversionPattern=%d{dd MMM HH:mm} %c{1}
> %-5p - %m%n
> 
> log4j.appender.Console=org.apache.log4j.ConsoleAppender 
> log4j.appender.Console.encoding=UTF-8 
> log4j.appender.Console.layout=org.apache.log4j.PatternLayout 
> log4j.appender.Console.layout.ConversionPattern=%d{dd MMM HH:mm}
> %c{1} %-5p - %m%n
> 
> #log4j.logger.org.apache.jcs=ERROR 
> #log4j.logger.net.fortuna.mstor=ERROR #log4j.logger.fuse=DEBUG 
> #log4j.logger.org.hibernate.SQL=DEBUG 
> #log4j.logger.org.hibernate=DEBUG 
> #log4j.additivity.org.hibernate.SQL=false

I see no appenders configured except for the ConsoleAppender. How are
your logs ending-up in /tmp?

There is obviously a lot more to the story than what you have posted.
Can we get more?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEyDUcACgkQ9CaO5/Lv0PD2/wCguRFcazfGEZmD+LQtahSnqe4D
kxUAn3HWQiK+CU4+RmbZceZR83cL4dyA
=YAII
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem with log level in tomcat.

Posted by Vihari Piratla <vi...@gmail.com>.
Christopher,
Please find the pasted properties file.
I did perform any of the steps that I am supposed if I got to use log4j,
but it still create muse(name of my web-app).log in /tmp directory with a
message like this in catalina.out.
01 Mar 12:28 Log4JUtils INFO  - Log messages will be recorded in
/tmp/tomcat7-tomcat7-tmp/muse.log
True that I am using log4j not juli in the webapp. This is how I am getting
the handle in the class files.
public static Log log = LogFactory.getLog(Crossword.class);

This is the log4j.properties file in the WEBINF/classes folder of the
webapp.
I tried few things like appending the line log4j.logger=debug with no avail.
# For the general syntax of property based configuration files see the
# documentation of org.apache.log4j.PropertyConfigurator.

# The root category uses the appender called A1. Since no priority is
# specified, the root category assumes the default priority for root
# which is DEBUG in log4j. The root category is the only category that
# has a default priority. All other categories need not be assigned a
# priority in which case they inherit their priority from the
# hierarchy.

log4j.rootCategory=INFO, Console

log4j.logger.com.opensymphony.xwork2=INFO
log4j.logger.freemarker.cache=INFO
log4j.logger.org.apache.struts2=INFO
log4j.logger.org.apache.xml.security=INFO
log4j.logger.org.apache.commons.httpclient=INFO
log4j.logger.org.mortbay.log=INFO
log4j.logger.net.sf.ehcache=OFF


#log4j.logger.com.hp.hpl.jena.tdb.base.block.BlockMgrMapped=ERROR, ROOT

# A1 is set to be a LF5Appender which outputs to a swing
# logging console.

# this is now done programmatically in JSPHelper
# log4j.appender.ROOT=org.apache.log4j.RollingFileAppender
# log4j.appender.ROOT.encoding=UTF-8
# log4j.appender.ROOT.MaxFileSize=5000KB
# log4j.appender.ROOT.File=muse.log
# Keep old files around
# log4j.appender.ROOT.MaxBackupIndex=2
# log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
# log4j.appender.ROOT.layout.ConversionPattern=%d{dd MMM HH:mm} %c{1} %-5p
- %m%n

log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.encoding=UTF-8
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{dd MMM HH:mm} %c{1} %-5p
- %m%n

#log4j.logger.org.apache.jcs=ERROR
#log4j.logger.net.fortuna.mstor=ERROR
#log4j.logger.fuse=DEBUG
#log4j.logger.org.hibernate.SQL=DEBUG
#log4j.logger.org.hibernate=DEBUG
#log4j.additivity.org.hibernate.SQL=false



On Fri, Mar 1, 2013 at 12:32 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Vihari,
>
> On 2/28/13 8:58 PM, Vihari Piratla wrote:
> > @Konstantin Kolinko Sorry I did not observe this, I was talking
> > about the global one previously, here is the webapp specific one in
> > the attachment that is log4j.properties.
>
> This list tends to strip attachments from posts. Please re-post with
> your configuration file.
>
> I see you said log4j.properties above... until now, you gave us the
> impression that you were using JULI (which is the default: using log4j
> with Tomcat at the server-level takes some work). Are you trying to
> use log4j or was that a typo?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iEYEAREIAAYFAlEwUn4ACgkQ9CaO5/Lv0PDErQCeJ+v9JS5sQPCCMmXJ/iiqihsc
> JKgAoKYEaZZvTBji26GjEtGOrXQZsKMw
> =yudQ
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Vihari Piratla.
students.iitmandi.ac.in/~p_vihari
*"If you can dream it, You can make it"*

Re: Problem with log level in tomcat.

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Vihari,

On 2/28/13 8:58 PM, Vihari Piratla wrote:
> @Konstantin Kolinko Sorry I did not observe this, I was talking
> about the global one previously, here is the webapp specific one in
> the attachment that is log4j.properties.

This list tends to strip attachments from posts. Please re-post with
your configuration file.

I see you said log4j.properties above... until now, you gave us the
impression that you were using JULI (which is the default: using log4j
with Tomcat at the server-level takes some work). Are you trying to
use log4j or was that a typo?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEwUn4ACgkQ9CaO5/Lv0PDErQCeJ+v9JS5sQPCCMmXJ/iiqihsc
JKgAoKYEaZZvTBji26GjEtGOrXQZsKMw
=yudQ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org