Hi!<br><br>I have been playing with logback for a couple of days and find a lot of its functionality amazing! I have a couple of questions that I was wondering if I could address!<br><br>I'm using logback to log information about a java server that I'm setting up. I want my log files to change every half hour and to never exceed 500MB. I would also like the logging system to cache 16MB of data before flushing to disk! Finally, I want the fileNamePattern to depend on the hostname where I'm running the server!<br>
<br>So this are my questions:<br>a. I have found a way for the log files to change every hour, but not every half hour... Is there a way to do this? Is there a way I can define my own RollingPolicy?<br>b. Is there a way for me to define the fileNamePattern somewhere else other than in the logback.xml file?<br>
c. Is there a flush() function I can call when my server exists?<br><br>For b. I have tried something like:<br><br>LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();<br> Logger logger = lc.getLogger("ROOT");<br>
<br> RollingFileAppender<ILoggingEvent> app = (RollingFileAppender<ILoggingEvent>)logger.getAppender("RootFileAppender");<br> RollingPolicyBase rollingPolicy = (RollingPolicyBase)app.getRollingPolicy();<br>
rollingPolicy.stop();<br> rollingPolicy.setFileNamePattern("bidderserver-%d{yyyy-MM-dd-HH:mm:ss}-"+hostname+"-ip.%i.log");<br> rollingPolicy.start();<br><br><br>But that doesn't seem to work :(<br>
<br>I'm attaching my current logback.xml file.<br><br>Any and all help would be much appreciated!<br><br><br>Also, I tried visiting #<a href="http://qos.ch">qos.ch</a> in freenode, but there's noone there except me!<br>
<br>Thanks again,<br>Daniel<br>