You are welcome ;)

Regards
JB

On 26/05/2019 08:26, Steinar Bang wrote:
>>>>>> Jean-Baptiste Onofré <[email protected]>:
> 
>> Hi Steinar,
>> yes, you can rotate by configuration in etc/org.ops4j.pax.logging.cfg.
> 
>> By configuration, the rotation is set to 16MB:
> 
>> # Rolling file appender
>> log4j2.appender.rolling.type = RollingRandomAccessFile
>> log4j2.appender.rolling.name = RollingFile
>> log4j2.appender.rolling.fileName = ${karaf.log}/karaf.log
>> log4j2.appender.rolling.filePattern = ${karaf.log}/karaf.log.%i
>> # uncomment to not force a disk flush
>> #log4j2.appender.rolling.immediateFlush = false
>> log4j2.appender.rolling.append = true
>> log4j2.appender.rolling.layout.type = PatternLayout
>> log4j2.appender.rolling.layout.pattern = ${log4j2.pattern}
>> log4j2.appender.rolling.policies.type = Policies
>> log4j2.appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
>> log4j2.appender.rolling.policies.size.size = 16MB
> 
> 
>> Just change the rolling.policies.size.size to the rotation you want.
> 
> Thanks, JB!
> 
> I SSH'd in to the karaf console and gave the following commands:
>  config:edit org.ops4j.pax.logging
>  config:property-set log4j2.appender.rolling.policies.size.size 1MB
>  config:update
> 
> (default for debian logrotate seems to be 100kB so I picked a middle
> ground between that and 16MB...:-) )
> 
> This morning, the logs had rotated:
>   /var/log/karaf:
>   total used in directory 16740 available 11603336
>   drwxr-xr-x  2 karaf karaf     4096 May 25 12:32 .
>   drwxr-xr-x 13 root  root      4096 May 26 05:09 ..
>   -rw-r--r--  1 karaf karaf    63507 May 26 07:07 karaf.log
>   -rw-r--r--  1 karaf karaf 15024655 May 25 12:22 karaf.log.1
> 
> Thanks again!
> 

-- 
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to