Hello!

So we have a use case where

+ Applications get redeployed frequently (10 per day)
+ The applications run in containers (Openshift)
+ The container hostname is always different on redeploy (new container)
+ The logfile is named after the container hostname (i.e. svc-2-asdf)

Using the RollingFileAppender with a

    <file>${HOSTNAME}.log</file>

and a TimeBasedRollingPolicy with a

    <fileNamePattern>${HOSTNAME}.%d{yyyy-MM-dd_HH-mm}.log.gz</fileNamePattern>

this works fine when we do not redeploy. On redeploy however the ${HOSTNAME} 
changes and logs are not compressed because the RollingFileAppender only 
compresses on roll which is every period (here: minute) if the filename is 
still in the same pattern, which its not here.

Similarly the <maxHistory> and the <cleanHistoryOnStart> do not work here. For 
this I have created a RollingFileAppender that compresses on shutdown. You can 
find it here:

https://gist.github.com/JonasGroeger/34bb004b30d18d8bc12642ba03141ac6

Is there another way without this custom Appender?

-- Jonas
_______________________________________________
logback-user mailing list
logback-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to