You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Roshni Basu <ro...@gmail.com> on 2011/06/22 13:46:24 UTC

Tomcat Logging level change

Hi,

I am changing the log level of tomcat to Level.WARNING. In this case I'm
trying to restart tomcat and see the logs, I can see the info level logs
like "INFO: Server startup in 50516 ms" .

I guess info level logs should not appear if log level set to warning.
Kindly let me know how exactly it behvaes and why am i getting info level
logs?
-- 
View this message in context: http://old.nabble.com/Tomcat-Logging-level-change-tp31902405p31902405.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Tomcat Logging level change

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

Roshni,

On 6/23/2011 4:49 AM, Roshni Basu wrote:
> Do i need to make any changes in the logging.properties file?

That's typically how logging is configured.

> I tried making everything from FINE to WARNING and also i tried adding
> org.apache.catalina.level=WARNING in the logging.properties, it somehow
> worked.

Did you read the documentation? The file itself is documented, somewhat,
also.

Remember that each logger can be configured differently. So, if you
configure one logger to be level=WARN, other loggers may default to
something else.

> But Is this the way it should behave or we need to make changes in
> my java code as well using that LogManager etc. Could you help me?

I would do this at the configuration-file level. As Konstantin points
out, webapps aren't allowed to change the logging configuration for the
server. That would be a security problem, don't you think?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4DVIYACgkQ9CaO5/Lv0PDi2gCfbmaX2Y0yud3YXk16Y/db79Lr
ZkQAn18f6dSmxGcMLM0YnZeUjcQRic+f
=Ilci
-----END PGP SIGNATURE-----

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


Re: Tomcat Logging level change

Posted by Roshni Basu <ro...@gmail.com>.
Do i need to make any chnages in the logging.properties file?
I tried making everything from FINE to WARNING and also i tried adding
org.apache.catalina.level=WARNING in the logging.properties, it somehow
worked. But Is this the way it should behave or we need to make changes in
my java code as well using that LogManager etc. Could you help me?

Konstantin Kolinko wrote:
> 
> 2011/6/22 Roshni Basu <ro...@gmail.com>:
>>
>>  Tomcat version is 6.0.9.
> 
> You know, 6.0.32 is out there...
> http://tomcat.apache.org/security-6.html
> 
>> Here is my snippet of code:
>>
>> LogManager logManager = LogManager.getLogManager();
>>        Enumeration<String> e = logManager.getLoggerNames();
> 
> It won't work, because the LogManager implementation used by Tomcat
> (see docs for details) provides isolation for different webapps (class
> loaders).
> 
> You code will affect only single webapp, and will have zero effect on
> anything else.
> 
> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Logging-level-change-tp31902405p31909658.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Tomcat Logging level change

Posted by Roshni Basu <ro...@gmail.com>.
So what exactly I can use to make it work in 6.0.9?

Konstantin Kolinko wrote:
> 
> 2011/6/22 Roshni Basu <ro...@gmail.com>:
>>
>>  Tomcat version is 6.0.9.
> 
> You know, 6.0.32 is out there...
> http://tomcat.apache.org/security-6.html
> 
>> Here is my snippet of code:
>>
>> LogManager logManager = LogManager.getLogManager();
>>        Enumeration<String> e = logManager.getLoggerNames();
> 
> It won't work, because the LogManager implementation used by Tomcat
> (see docs for details) provides isolation for different webapps (class
> loaders).
> 
> You code will affect only single webapp, and will have zero effect on
> anything else.
> 
> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Logging-level-change-tp31902405p31908461.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Tomcat Logging level change

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/6/22 Roshni Basu <ro...@gmail.com>:
>
>  Tomcat version is 6.0.9.

You know, 6.0.32 is out there...
http://tomcat.apache.org/security-6.html

> Here is my snippet of code:
>
> LogManager logManager = LogManager.getLogManager();
>        Enumeration<String> e = logManager.getLoggerNames();

It won't work, because the LogManager implementation used by Tomcat
(see docs for details) provides isolation for different webapps (class
loaders).

You code will affect only single webapp, and will have zero effect on
anything else.

Best regards,
Konstantin Kolinko

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


Re: Tomcat Logging level change

Posted by Roshni Basu <ro...@gmail.com>.
Basically I have an web application running on tomcat. 

Mark Thomas wrote:
> 
> On 22/06/2011 16:16, Roshni Basu wrote:
>> 
>> I have created a java file. And running this. Could you elaborate what
>> exactly you want to know?
> 
> I want to know how this code is being executed. When does it run? What
> triggers it?
> 
> Mark
> 
>> 
>> Mark Thomas wrote:
>>>
>>> On 22/06/2011 16:03, Roshni Basu wrote:
>>>>
>>>>  Tomcat version is 6.0.9.
>>>> Here is my snippet of code:
>>>>
>>>> LogManager logManager = LogManager.getLogManager();
>>>>         Enumeration<String> e = logManager.getLoggerNames();
>>>>         while (e.hasMoreElements())
>>>>         {
>>>>             String loggername = e.nextElement();
>>>>             Logger logger = logManager.getLogger(loggername);
>>>>             Handler[] handlers = logger.getHandlers();
>>>>             if (handlers != null && handlers.length != 0)
>>>>             {
>>>>                 for (Handler h : handlers)
>>>>                 {
>>>>                     h.setLevel(Level.WARNING);
>>>>                 }
>>>>                 logger.setLevel(Level.WARNING);
>>>>             }
>>>>         }
>>>
>>> Which is running where exactly?
>>>
>>> Mark
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Logging-level-change-tp31902405p31904384.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Tomcat Logging level change

Posted by Roshni Basu <ro...@gmail.com>.
Its working fine when I set to "Fine". In catalina.out i can see "fine" and
"info" logs butwhen I set to warning, even info level logs appear.

n828cl wrote:
> 
>> From: Roshni Basu [mailto:roshniblr@gmail.com] 
>> Subject: Re: Tomcat Logging level change
> 
>> I just run it when I need to change the log level.
> 
> (This is like pulling teeth.)  You're providing virtually no useful
> information here.  You run the program where?  As a servlet?  Standalone? 
> In some listener inside Tomcat?  
> 
> If you run it outside of Tomcat, why do you think it would have any effect
> on what's going on inside Tomcat?
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Logging-level-change-tp31902405p31904743.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Tomcat Logging level change

Posted by Roshni Basu <ro...@gmail.com>.
Application is running on tomcat.

n828cl wrote:
> 
>> From: Roshni Basu [mailto:roshniblr@gmail.com] 
>> Subject: Re: Tomcat Logging level change
> 
>> I just run it when I need to change the log level.
> 
> (This is like pulling teeth.)  You're providing virtually no useful
> information here.  You run the program where?  As a servlet?  Standalone? 
> In some listener inside Tomcat?  
> 
> If you run it outside of Tomcat, why do you think it would have any effect
> on what's going on inside Tomcat?
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Logging-level-change-tp31902405p31904708.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Tomcat Logging level change

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Roshni Basu [mailto:roshniblr@gmail.com] 
> Subject: Re: Tomcat Logging level change

> I just run it when I need to change the log level.

(This is like pulling teeth.)  You're providing virtually no useful information here.  You run the program where?  As a servlet?  Standalone?  In some listener inside Tomcat?  

If you run it outside of Tomcat, why do you think it would have any effect on what's going on inside Tomcat?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: Tomcat Logging level change

Posted by Roshni Basu <ro...@gmail.com>.
I just run it when I need to change the log level.

Mark Thomas wrote:
> 
> On 22/06/2011 16:16, Roshni Basu wrote:
>> 
>> I have created a java file. And running this. Could you elaborate what
>> exactly you want to know?
> 
> I want to know how this code is being executed. When does it run? What
> triggers it?
> 
> Mark
> 
>> 
>> Mark Thomas wrote:
>>>
>>> On 22/06/2011 16:03, Roshni Basu wrote:
>>>>
>>>>  Tomcat version is 6.0.9.
>>>> Here is my snippet of code:
>>>>
>>>> LogManager logManager = LogManager.getLogManager();
>>>>         Enumeration<String> e = logManager.getLoggerNames();
>>>>         while (e.hasMoreElements())
>>>>         {
>>>>             String loggername = e.nextElement();
>>>>             Logger logger = logManager.getLogger(loggername);
>>>>             Handler[] handlers = logger.getHandlers();
>>>>             if (handlers != null && handlers.length != 0)
>>>>             {
>>>>                 for (Handler h : handlers)
>>>>                 {
>>>>                     h.setLevel(Level.WARNING);
>>>>                 }
>>>>                 logger.setLevel(Level.WARNING);
>>>>             }
>>>>         }
>>>
>>> Which is running where exactly?
>>>
>>> Mark
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Logging-level-change-tp31902405p31904220.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Tomcat Logging level change

Posted by Mark Thomas <ma...@apache.org>.
On 22/06/2011 16:16, Roshni Basu wrote:
> 
> I have created a java file. And running this. Could you elaborate what
> exactly you want to know?

I want to know how this code is being executed. When does it run? What
triggers it?

Mark

> 
> Mark Thomas wrote:
>>
>> On 22/06/2011 16:03, Roshni Basu wrote:
>>>
>>>  Tomcat version is 6.0.9.
>>> Here is my snippet of code:
>>>
>>> LogManager logManager = LogManager.getLogManager();
>>>         Enumeration<String> e = logManager.getLoggerNames();
>>>         while (e.hasMoreElements())
>>>         {
>>>             String loggername = e.nextElement();
>>>             Logger logger = logManager.getLogger(loggername);
>>>             Handler[] handlers = logger.getHandlers();
>>>             if (handlers != null && handlers.length != 0)
>>>             {
>>>                 for (Handler h : handlers)
>>>                 {
>>>                     h.setLevel(Level.WARNING);
>>>                 }
>>>                 logger.setLevel(Level.WARNING);
>>>             }
>>>         }
>>
>> Which is running where exactly?
>>
>> Mark
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
> 




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


Re: Tomcat Logging level change

Posted by Roshni Basu <ro...@gmail.com>.
I have created a java file. And running this. Could you elaborate what
exactly you want to know?

Mark Thomas wrote:
> 
> On 22/06/2011 16:03, Roshni Basu wrote:
>> 
>>  Tomcat version is 6.0.9.
>> Here is my snippet of code:
>> 
>> LogManager logManager = LogManager.getLogManager();
>>         Enumeration<String> e = logManager.getLoggerNames();
>>         while (e.hasMoreElements())
>>         {
>>             String loggername = e.nextElement();
>>             Logger logger = logManager.getLogger(loggername);
>>             Handler[] handlers = logger.getHandlers();
>>             if (handlers != null && handlers.length != 0)
>>             {
>>                 for (Handler h : handlers)
>>                 {
>>                     h.setLevel(Level.WARNING);
>>                 }
>>                 logger.setLevel(Level.WARNING);
>>             }
>>         }
> 
> Which is running where exactly?
> 
> Mark
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Logging-level-change-tp31902405p31904108.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Tomcat Logging level change

Posted by Mark Thomas <ma...@apache.org>.
On 22/06/2011 16:03, Roshni Basu wrote:
> 
>  Tomcat version is 6.0.9.
> Here is my snippet of code:
> 
> LogManager logManager = LogManager.getLogManager();
>         Enumeration<String> e = logManager.getLoggerNames();
>         while (e.hasMoreElements())
>         {
>             String loggername = e.nextElement();
>             Logger logger = logManager.getLogger(loggername);
>             Handler[] handlers = logger.getHandlers();
>             if (handlers != null && handlers.length != 0)
>             {
>                 for (Handler h : handlers)
>                 {
>                     h.setLevel(Level.WARNING);
>                 }
>                 logger.setLevel(Level.WARNING);
>             }
>         }

Which is running where exactly?

Mark



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


Re: Tomcat Logging level change

Posted by Roshni Basu <ro...@gmail.com>.
 Tomcat version is 6.0.9.
Here is my snippet of code:

LogManager logManager = LogManager.getLogManager();
        Enumeration<String> e = logManager.getLoggerNames();
        while (e.hasMoreElements())
        {
            String loggername = e.nextElement();
            Logger logger = logManager.getLogger(loggername);
            Handler[] handlers = logger.getHandlers();
            if (handlers != null && handlers.length != 0)
            {
                for (Handler h : handlers)
                {
                    h.setLevel(Level.WARNING);
                }
                logger.setLevel(Level.WARNING);
            }
        }

Konstantin Kolinko wrote:
> 
> 2011/6/22 Roshni Basu <ro...@gmail.com>:
>>
>> I am changing the log level of tomcat to Level.WARNING. In this case I'm
>> trying to restart tomcat and see the logs, I can see the info level logs
>> like "INFO: Server startup in 50516 ms" .
>> I guess info level logs should not appear if log level set to warning.
> 
> 1. If you did it correctly then yes, they should not appear. But what
> exactly did you? Please be specific.
> 
> 2. Exact Tomcat version, etc.
> 
>> Kindly let me know how exactly it behvaes
> 
> The sources are all available.
> java.util.logging documentation is available from Oracle.
> 
> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Tomcat-Logging-level-change-tp31902405p31903978.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Tomcat Logging level change

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/6/22 Roshni Basu <ro...@gmail.com>:
>
> I am changing the log level of tomcat to Level.WARNING. In this case I'm
> trying to restart tomcat and see the logs, I can see the info level logs
> like "INFO: Server startup in 50516 ms" .
> I guess info level logs should not appear if log level set to warning.

1. If you did it correctly then yes, they should not appear. But what
exactly did you? Please be specific.

2. Exact Tomcat version, etc.

> Kindly let me know how exactly it behvaes

The sources are all available.
java.util.logging documentation is available from Oracle.

Best regards,
Konstantin Kolinko

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