logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wesleywj2 <wesley...@yahoo.co.uk>
Subject Re: can log4j overwriting and wrong time/date rollover
Date Tue, 27 May 2008 02:18:34 GMT

hi jake,

thanks for the reply, i've research on the system properties topic for
configuring this logging as you 
pointed out. I'm a bit confused later on as there are only one webapps and
only one own written servlet for logging purpose referred by 2 tomcat. the
things bothered me was:- 

+where should i define the "${log.home}/main.log"?, would it be on tomcat
itself? 
+for the vm's referring to same config file, where should i define the log
to be written while there's only on  servlet on the run? 

please advise.

Regards,
Wesley







Jacob Kjome wrote:
> 
> 
> Define your log path as something like...
> 
> ${log.home}/main.log
> 
> Then set the system property either at system startup, such as...
> 
> -Dlog.home=/path/to/log/directory
> 
> ...Or set it programatically before Log4j is configured. 
> 
> Now two VM's can refer to the same config file while writing to separate 
> directories.
> 
> Jake
> 
> On Mon, 19 May 2008 14:57:59 -0700 (PDT)
>   wesleywj2 <wesleywj2@yahoo.co.uk> wrote:
>> 
>> hi James,
>> 
>> based on this situation, how do i use system property to make them write
>> different files? can you give me a short sample or pointers? thanks much.
>> 
>> 
>> James A. N. Stauffer wrote:
>>> 
>>> You can't have 2 JVMs writing to the same file.  You could use a
>>> system property to make them write to different files.
>>> 
>>> On Thu, Apr 24, 2008 at 4:25 AM, wesleywj2 <wesleywj2@yahoo.co.uk>
>>> wrote:
>>>>
>>>> hi everyone,
>>>>
>>>> i faced with a rather weird outcome of log4j. first of all to load
>>>> preface
>>>> information,
>>>> i'm using apache2.2 and load balanced 2 tomcat version 6 called tomcat1
>>>> &
>>>> tomcat2 respectively. i made the tomcat1 & 2
>>>> point to a single webapp directory.
>>>>
>>>> rough diagram looks like this:
>>>>
>>>>     Apache2.2
>>>>         |
>>>>     ---------
>>>>     |        |
>>>>  tomcat1    tomcat2
>>>>    |           |
>>>>    -------------
>>>>          |
>>>>       webapps
>>>>
>>>> as depicted above, any request send from apache to tomcat1 and
>>>> tomcat2 will use the same copy of servlet within the
>>>> webapps/WEB-INF/classes
>>>> dir. i set the log file to eg. "/log/mylog.log". the log4j settings is
>>>> as
>>>> below.
>>>>
>>>> --------------------------------
>>>> <p>
>>>> log4j.rootLogger    =DEBUG,DAILY
>>>> log4j.appender.DAILY=org.apache.log4j.DailyRollingFileAppender
>>>> log4j.appender.DAILY.layout=org.apache.log4j.PatternLayout
>>>> log4j.appender.DAILY.File=/log/mylog.log
>>>> log4j.appender.DAILY.Append=true
>>>>
>>>> log4j.appender.DAILY.DatePattern='.'yyyy-MM-dd-HH
>>>> log4j.appender.DAILY.layout.ConversionPattern=%d %-5p [%t] %-17c{2} %3x
>>>> -
>>>> %m%n
>>>> </p>
>>>>
>>>> based on the setting above, it should log every top hour
>>>> per file.
>>>>
>>>> There are 2 problems i'm facing now:
>>>> 1.
>>>> It logs every hour as expected. But the name of the file
>>>> where hour indicated differently than the contents  being log.
>>>>   eg. filename is "mylog.log.2008-04-20-13" indicate 1pm.
>>>>       but the contents inside logs 2pm onwards.
>>>>
>>>> 2.
>>>> Log4j normally rollover and copy a new past hour to a new file. Leaving
>>>> the
>>>> default mylog.log as the current logging data before rollover and copy
>>>> to
>>>> another file (that is, currently logging 2pm onwards). But i saw it
>>>> logging both files at the same time in "mylog.log" and
>>>> "mylog.log.2008-04-20-13". The file "mylog.log" logging 2pm onwards
>>>> which
>>>> is
>>>> correct but it still log 2pm onwards /append the same information to
>>>> "mylog.log.2008-04-20-13".
>>>>
>>>> i suspect it might be something to do with concurrency/thread issue
>>>> while
>>>> logging the file.
>>>>
>>>> +has anyone ever come across any of this?
>>>> +did i not do correctly on the log settings?
>>>> +can DailyRollingFileAppender actually handle this rollover issue?
>>>>
>>>> please, this is rather headache to me and anyone would be kind enough
>>>> to
>>>> give me a pointer to overcome this. Thanks.
>>>>
>>>> Wesley
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/can-log4j-overwriting-and-wrong-time-date-rollover-tp16848372p16848372.html
>>>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>>>
>>> 
>>> 
>>> 
>>> -- 
>>> James A. N. Stauffer http://www.geocities.com/stauffer_james/
>>> Are you good? Take the test at http://www.livingwaters.com/good/
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context: 
>>http://www.nabble.com/can-log4j-overwriting-and-wrong-time-date-rollover-tp16848372p17329064.html
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/can-log4j-overwriting-and-wrong-time-date-rollover-tp16848372p17481794.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message