You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by val <yu...@tlen.pl> on 2006/12/04 16:37:53 UTC

Re: How create 1 log file for a day?


Since last time i used

Configuration for LOG4CXX 0.9.7:

log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=output/temp
log4j.appender.R.DatePattern=.%Y-%m-%d-%H-%M
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{%Y-%m-%d %H:%M:%S,%Q} [%t] %-5p
%.16c - %m%n

it works very well. But now i use version 0.10.0 
and this configuration doesn't work wel:
log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.R.File=output/temp
log4j.appender.R.DatePattern=.%Y-%m-%d-%H-%M
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t]
%-5p %.16c - %m%n

What is difference between 0.9.7 and 0.10.0 for DailyRollingFileAppender
Configurator.
-- 
View this message in context: http://www.nabble.com/How-create-1-log-file-for-a-day--tf2195568.html#a7680622
Sent from the Log4cxx - Users mailing list archive at Nabble.com.


Re: How create 1 log file for a day?

Posted by val <yu...@tlen.pl>.




Curt Arnold wrote:
> 
> On Dec 4, 2006, at 9:37 AM, val wrote:
> 
>>
>>
>> Since last time i used
>>
>> Configuration for LOG4CXX 0.9.7:
>>
>> log4j.rootLogger=DEBUG, R
>> log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
>> log4j.appender.R.File=output/temp
>> log4j.appender.R.DatePattern=.%Y-%m-%d-%H-%M
>> log4j.appender.R.layout=org.apache.log4j.PatternLayout
>> log4j.appender.R.layout.ConversionPattern=%d{%Y-%m-%d %H:%M:%S,%Q}  
>> [%t] %-5p
>> %.16c - %m%n
> 
>>
>> it works very well. But now i use version 0.10.0
>> and this configuration doesn't work wel:
>> log4j.rootLogger=DEBUG, R
>> log4j.appender.R=org.apache.log4j.rolling.RollingFileAppender
>> log4j.appender.R.File=output/temp
>> log4j.appender.R.DatePattern=.%Y-%m-%d-%H-%M
>> log4j.appender.R.layout=org.apache.log4j.PatternLayout
>> log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd  
>> HH:mm:ss,SSS} [%t]
>> %-5p %.16c - %m%n
>>
>> What is difference between 0.9.7 and 0.10.0 for  
>> DailyRollingFileAppender
>> Configurator.
>>
> 
> log4cxx 0.9.7 only supported strftime ("%Y...") type format  
> specifiers which were not supported by log4j.  0.10.0 now supports  
> java.util.SimpleDateFormat style format specifiers (to be compatible  
> with log4j configuration files) but will try to detect strftime  
> format specifiers for compatibility with log4cxx 0.9.7 configuration  
> files.  the 0.10.0 implementation uses apr_strftime which may behave  
> differently than the native strftime (most commonly %Q is not  
> supported).
> 
> I would suggest changing the DatePattern to a SimpleDateTime format  
> specifier and see what happens.  That is:
> 
> log4j.appender.R.DatePattern='.'yyyy-MM-dd_HH_mm
> 
> I don't know why the period is quoted in the tests/input/rolling/ 
> obsoleteDRFA1.properties where I borrowed the fragment.
> 
> I did modify tests/input/rolling/obsoleteDRFA1.properties in my  
> working copy to use strftime style format specifiers but the test  
> still passed, so I'm not sure what problem you are seeing.
> 
> Your format string would not get you one file per day, but would get  
> you one file per minute, but I assume that you knew that.
> 
> 

hi 

It seems that log4j.appender.R.DatePattern='.'yyyy-MM-dd_HH_mm doesn't work
even for logging every minute.
But still log to to  one file: /output/temp without div like in version
0.9.7
Maybe problem isn't here?

///MY LAST CONFIG:
log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.Append=true
log4j.appender.R.File=output/temp
log4j.appender.R.DatePattern='.'yyyy-MM-dd_HH_mm
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t]
%-5p %.16c - %m%n
#####




-- 
View this message in context: http://www.nabble.com/How-create-1-log-file-for-a-day--tf2195568.html#a7721616
Sent from the Log4cxx - Users mailing list archive at Nabble.com.


Re: How create 1 log file for a day?

Posted by Curt Arnold <ca...@apache.org>.
On Dec 4, 2006, at 9:37 AM, val wrote:

>
>
> Since last time i used
>
> Configuration for LOG4CXX 0.9.7:
>
> log4j.rootLogger=DEBUG, R
> log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.R.File=output/temp
> log4j.appender.R.DatePattern=.%Y-%m-%d-%H-%M
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%d{%Y-%m-%d %H:%M:%S,%Q}  
> [%t] %-5p
> %.16c - %m%n
>
> it works very well. But now i use version 0.10.0
> and this configuration doesn't work wel:
> log4j.rootLogger=DEBUG, R
> log4j.appender.R=org.apache.log4j.rolling.RollingFileAppender
> log4j.appender.R.File=output/temp
> log4j.appender.R.DatePattern=.%Y-%m-%d-%H-%M
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd  
> HH:mm:ss,SSS} [%t]
> %-5p %.16c - %m%n
>
> What is difference between 0.9.7 and 0.10.0 for  
> DailyRollingFileAppender
> Configurator.
>

log4cxx 0.9.7 only supported strftime ("%Y...") type format  
specifiers which were not supported by log4j.  0.10.0 now supports  
java.util.SimpleDateFormat style format specifiers (to be compatible  
with log4j configuration files) but will try to detect strftime  
format specifiers for compatibility with log4cxx 0.9.7 configuration  
files.  the 0.10.0 implementation uses apr_strftime which may behave  
differently than the native strftime (most commonly %Q is not  
supported).

I would suggest changing the DatePattern to a SimpleDateTime format  
specifier and see what happens.  That is:

log4j.appender.R.DatePattern='.'yyyy-MM-dd_HH_mm

I don't know why the period is quoted in the tests/input/rolling/ 
obsoleteDRFA1.properties where I borrowed the fragment.

I did modify tests/input/rolling/obsoleteDRFA1.properties in my  
working copy to use strftime style format specifiers but the test  
still passed, so I'm not sure what problem you are seeing.

Your format string would not get you one file per day, but would get  
you one file per minute, but I assume that you knew that.