You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Kaushal Shriyan <ka...@gmail.com> on 2010/07/07 08:28:23 UTC
log4j
Hi,
I am running tomcat server apache-tomcat-5.5.27. I have set the below
parameters in log4j.properties
log4j.rootLogger=INFO, R
log4j.appender.R=org.apache.log4j.ISTDailyRollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/catalina.out
log4j.appender.R.DatePattern='.'yyyy-MM-dd
log4j.appender.R.layout=org.apache.log4j.PatternLayout
ist-appender.jar,log4j-1.2.15.jar and commons-logging-1.1.1.jar under
common/lib directory.
The above settings didnot worked. is there a way to know why it didnot worked
Please suggest/guide
Thanks
Kaushal
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: log4j
Posted by Jacob Kjome <ho...@visi.com>.
On Thu, 8 Jul 2010 18:32:31 +0530
Kaushal Shriyan <ka...@gmail.com> wrote:
> On Thu, Jul 8, 2010 at 6:14 PM, Jacob Kjome <ho...@visi.com> wrote:
>> On Thu, 8 Jul 2010 17:59:23 +0530
>> Kaushal Shriyan <ka...@gmail.com> wrote:
>>>
>>> On Thu, Jul 8, 2010 at 5:48 PM, Jacob Kjome <ho...@visi.com> wrote:
>>>>
>>>> When -Dlog4j.debug=true is set, Log4j prints its configuration progress
>>>> to
>>>> System.err. With this, you should be able to see which config file is
>>>> being
>>>> picked up
>>>
>>> Thanks Jake.
>>>
>>> Thanks, I could see it on catalina.out file where in system.out and
>>> system.err files goes.
>>>
>>>> You can run your appender at a specified time by not placing
>>>> log4j.properties in the classpath. But then you'll have to manually
>>>> configure it at some later point.
>>>>
>>> Please help me understand by providing examples.
>>>
>>> Basically if i set log4j.appender.R.DatePattern='.'yyyy-MM-dd in
>>> log4j.properties It rolls over at midnight. is there a way to roll
>>> over at say 12:00 Noon afternoon
>>>
>>
>> Oh, I see. Sorry, I thought you were asking if you could delay
>> instantiation of your appender. Rather, you want to define when it rolls.
>> See:
>>
>> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html
>>
>> As you can see, DailyRollingFileAppender is somewhat lacking in
>> flexibility. You may have more luck with the Log4j-extras companion [1].
>> Specifically, RollingFileAppender [2] with a TimeBasedRollingPolicy [3].
>>
>> [1] http://logging.apache.org/log4j/companions/extras/index.html
>> [2]
>> http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html
>> [3]
>> http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/TimeBasedRollingPolicy.html
>>
>>
>> Jake
>
> Jake,
>
> I referred to
>http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/TimeBasedRollingPolicy.html
> it has only two options
>
> /wombat/folder/foo.%d (Daily rollover (at midnight). Due to the
> omission of the optional time and date pattern for the %d token
> specifier, the default pattern of "yyyy-MM-dd" is assumed, which
> corresponds to daily rollover.)
>
> /wombat/foo.%d{yyyy-MM}.log (Rollover at the beginning of each month.)
>
> Not sure though how it would fit it into my specific needs.
>
You're not reading closely enough. The first example leaves off the "optional
time and date". The second example leaves off the "optional time". Using the
optional time is the key.
The Logback docs contain some more documentation on the
TimeBasedRollingPolicy, which shows some time configuration. That said, it
doesn't provide an example for using a specific time of day. You might want
to post a separate thread on the Log4j-user list or even the Logback list to
see if someone knows the proper syntax. It seems like it should be possible.
http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy
You should be able to go by this documentation as both the Log4j-extras and
Logback implementations have the same origin: the discontinued Log4j 1.3
effort.
Jake
> Apologies for bugging
>
> Please suggest/further
>
> Thanks and Regards
>
> Kaushal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: log4j
Posted by Kaushal Shriyan <ka...@gmail.com>.
On Thu, Jul 8, 2010 at 6:14 PM, Jacob Kjome <ho...@visi.com> wrote:
> On Thu, 8 Jul 2010 17:59:23 +0530
> Kaushal Shriyan <ka...@gmail.com> wrote:
>>
>> On Thu, Jul 8, 2010 at 5:48 PM, Jacob Kjome <ho...@visi.com> wrote:
>>>
>>> When -Dlog4j.debug=true is set, Log4j prints its configuration progress
>>> to
>>> System.err. With this, you should be able to see which config file is
>>> being
>>> picked up
>>
>> Thanks Jake.
>>
>> Thanks, I could see it on catalina.out file where in system.out and
>> system.err files goes.
>>
>>> You can run your appender at a specified time by not placing
>>> log4j.properties in the classpath. But then you'll have to manually
>>> configure it at some later point.
>>>
>> Please help me understand by providing examples.
>>
>> Basically if i set log4j.appender.R.DatePattern='.'yyyy-MM-dd in
>> log4j.properties It rolls over at midnight. is there a way to roll
>> over at say 12:00 Noon afternoon
>>
>
> Oh, I see. Sorry, I thought you were asking if you could delay
> instantiation of your appender. Rather, you want to define when it rolls.
> See:
>
> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html
>
> As you can see, DailyRollingFileAppender is somewhat lacking in
> flexibility. You may have more luck with the Log4j-extras companion [1].
> Specifically, RollingFileAppender [2] with a TimeBasedRollingPolicy [3].
>
> [1] http://logging.apache.org/log4j/companions/extras/index.html
> [2]
> http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html
> [3]
> http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/TimeBasedRollingPolicy.html
>
>
> Jake
Jake,
I referred to http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/TimeBasedRollingPolicy.html
it has only two options
/wombat/folder/foo.%d (Daily rollover (at midnight). Due to the
omission of the optional time and date pattern for the %d token
specifier, the default pattern of "yyyy-MM-dd" is assumed, which
corresponds to daily rollover.)
/wombat/foo.%d{yyyy-MM}.log (Rollover at the beginning of each month.)
Not sure though how it would fit it into my specific needs.
Apologies for bugging
Please suggest/further
Thanks and Regards
Kaushal
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: log4j
Posted by Jacob Kjome <ho...@visi.com>.
On Thu, 8 Jul 2010 17:59:23 +0530
Kaushal Shriyan <ka...@gmail.com> wrote:
> On Thu, Jul 8, 2010 at 5:48 PM, Jacob Kjome <ho...@visi.com> wrote:
>> When -Dlog4j.debug=true is set, Log4j prints its configuration progress to
>> System.err. With this, you should be able to see which config file is being
>> picked up
>
> Thanks Jake.
>
> Thanks, I could see it on catalina.out file where in system.out and
> system.err files goes.
>
>> You can run your appender at a specified time by not placing
>> log4j.properties in the classpath. But then you'll have to manually
>> configure it at some later point.
>>
> Please help me understand by providing examples.
>
> Basically if i set log4j.appender.R.DatePattern='.'yyyy-MM-dd in
> log4j.properties It rolls over at midnight. is there a way to roll
> over at say 12:00 Noon afternoon
>
Oh, I see. Sorry, I thought you were asking if you could delay instantiation
of your appender. Rather, you want to define when it rolls. See:
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html
As you can see, DailyRollingFileAppender is somewhat lacking in flexibility.
You may have more luck with the Log4j-extras companion [1]. Specifically,
RollingFileAppender [2] with a TimeBasedRollingPolicy [3].
[1] http://logging.apache.org/log4j/companions/extras/index.html
[2]
http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html
[3]
http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/TimeBasedRollingPolicy.html
Jake
> Please suggest/guide further
>
> Thanks, Kaushal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: log4j
Posted by Kaushal Shriyan <ka...@gmail.com>.
On Thu, Jul 8, 2010 at 5:48 PM, Jacob Kjome <ho...@visi.com> wrote:
> When -Dlog4j.debug=true is set, Log4j prints its configuration progress to
> System.err. With this, you should be able to see which config file is being
> picked up
Thanks Jake.
Thanks, I could see it on catalina.out file where in system.out and
system.err files goes.
> You can run your appender at a specified time by not placing
> log4j.properties in the classpath. But then you'll have to manually
> configure it at some later point.
>
Please help me understand by providing examples.
Basically if i set log4j.appender.R.DatePattern='.'yyyy-MM-dd in
log4j.properties It rolls over at midnight. is there a way to roll
over at say 12:00 Noon afternoon
Please suggest/guide further
Thanks, Kaushal
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: log4j
Posted by Jacob Kjome <ho...@visi.com>.
When -Dlog4j.debug=true is set, Log4j prints its configuration progress to
System.err. With this, you should be able to see which config file is being
picked up.
You can run your appender at a specified time by not placing log4j.properties
in the classpath. But then you'll have to manually configure it at some later
point.
Note that if you also place a log4j.jar with WEB-INF/lib and another Log4j
config file in WEB-INF/classes of your webapp, you will get a separate logger
repository from the server containing a different configuration. If you
remove your config file from WEB-INF/classes, you'll still have a separate
logger repository from the server but use the same config as the server.
Jake
On Thu, 8 Jul 2010 10:21:39 +0530
Kaushal Shriyan <ka...@gmail.com> wrote:
> On Wed, Jul 7, 2010 at 8:28 PM, Jacob Kjome <ho...@visi.com> wrote:
>>
>> Where did you put log4j.properties? For Tomcat 5.5.xx, it should be in
>> CATALINA_HOME/common/classes.
>>
>> Try adding the following to CATALINA_OPTS....
>>
>> -Dlog4j.debug=true
>>
>> Jake
>>
> Hi Jake
>
> Thanks for the quick reply. is there a way to run log4j appender at a
> specified time?
>
> log4j.rootLogger=INFO, R
> log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.R.File=${catalina.home}/logs/catalina.out
> log4j.appender.R.DatePattern='.'yyyy-MM-dd
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
>
> I have put the log4j.properties under /opt/tomcat0/common/classes and
> have added -Dlog4j.debug=true under CATALINA_OPTS variable.
> where do i look for the debug logs.
>
> Please suggest.
>
> Thanks and Regards
>
> Kaushal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: log4j
Posted by Kaushal Shriyan <ka...@gmail.com>.
On Wed, Jul 7, 2010 at 8:28 PM, Jacob Kjome <ho...@visi.com> wrote:
>
> Where did you put log4j.properties? For Tomcat 5.5.xx, it should be in
> CATALINA_HOME/common/classes.
>
> Try adding the following to CATALINA_OPTS....
>
> -Dlog4j.debug=true
>
> Jake
>
Hi Jake
Thanks for the quick reply. is there a way to run log4j appender at a
specified time?
log4j.rootLogger=INFO, R
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/catalina.out
log4j.appender.R.DatePattern='.'yyyy-MM-dd
log4j.appender.R.layout=org.apache.log4j.PatternLayout
I have put the log4j.properties under /opt/tomcat0/common/classes and
have added -Dlog4j.debug=true under CATALINA_OPTS variable.
where do i look for the debug logs.
Please suggest.
Thanks and Regards
Kaushal
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: log4j
Posted by Jacob Kjome <ho...@visi.com>.
Where did you put log4j.properties? For Tomcat 5.5.xx, it should be in
CATALINA_HOME/common/classes.
Try adding the following to CATALINA_OPTS....
-Dlog4j.debug=true
Jake
On Wed, 7 Jul 2010 11:58:23 +0530
Kaushal Shriyan <ka...@gmail.com> wrote:
> Hi,
>
> I am running tomcat server apache-tomcat-5.5.27. I have set the below
> parameters in log4j.properties
>
> log4j.rootLogger=INFO, R
> log4j.appender.R=org.apache.log4j.ISTDailyRollingFileAppender
> log4j.appender.R.File=${catalina.home}/logs/catalina.out
> log4j.appender.R.DatePattern='.'yyyy-MM-dd
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
>
> ist-appender.jar,log4j-1.2.15.jar and commons-logging-1.1.1.jar under
> common/lib directory.
>
> The above settings didnot worked. is there a way to know why it didnot
>worked
>
> Please suggest/guide
>
> Thanks
>
> Kaushal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org