How to keep rolling log file as per file size?

Open 1 Answers 17 Views Web Development

I am working on a project in which I am logging bunch of stuff in a file and I want to make sure my log file is getting rolled as soon as a fixed limit for file is reached. I have a below logback.xml file but it looks like file size is not working. I see my file size as 793M but limit I have is 100M

    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <pattern>%date %level [%thread] %msg%n</pattern>
            <!-- this improves logging throughput -->

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder 
            by default -->
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n

    <root level="INFO">
        <appender-ref ref="FILE" />
        <appender-ref ref="STDOUT" />

What wrong I am doing here? And also what is the best policy we should follow in production in terms of logging? We are logging bunch of stuff in a file and we don't want to fill up the disk with this log file.

1 Answer

Contact your hosting provider and let them fix the apache configuration for you.
answered May 23, 2016 by michael New Member (1,010 points)