According to this link: http://logback.qos.ch/manual/appenders.html (in RollingFileAppender)
It seems to me that Logback provides only a limited way of how to roll a log file. Based on time, it can roll a log file only in specific interval like once per hour, once per minute. It does not mention how to roll a log file programmatically which is what I desire. I need some way to allow users to decide when to roll a log file and the log file will be used later by the user.
I did some research using Google but found nothing. Could you please tell me how to roll a log file programmatically
Thank in advance.
Edit: At least I need some way to specify an interval like roll a log file once a ten minutes.
I suggest to make your own implementation of the TriggeringPolicy
. So, make your own implementation (it will check a global variable set by user) and configure the logback with your class.
Not sure about your "Edit:". Sounds like a standard TimeBasedRollingPolicy
configuration.