Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java setting logging with rotation logback

<configuration>
 
    <property name="HOME_LOG" value="logs/app.log"/>
 
    <appender name="FILE-ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${HOME_LOG}</file>
 
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>logs/archived/app.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
            <!-- each archived file, size max 10MB -->
            <!-- CHANGE HERE -->
            <maxFileSize>10MB</maxFileSize>
            <!-- total size of all archive files, if total size > 20GB, it will delete old archived file -->
            <!-- CHANGE HERE -->
            <totalSizeCap>20GB</totalSizeCap>
            <!-- 60 days to keep -->
            <!-- CHANGE HERE -->
            <maxHistory>60</maxHistory>
        </rollingPolicy>
 
        <encoder>
            <pattern>%d %p %c{1.} [%t] %m%n</pattern>
        </encoder>
    </appender>
 
    <logger name="com.test" level="debug" additivity="false">
        <appender-ref ref="FILE-ROLLING"/>
    </logger>
 
    <root level="error">
        <appender-ref ref="FILE-ROLLING"/>
    </root>
 
</configuration>
Comment

PREVIOUS NEXT
Code Example
Java :: Java Insert Elements to TreeSet 
Java :: system.out.println(h [2] [1] [1] [0]); 
Java :: quick select method for kth smallest element in java 
Java :: java cannot resolve the list method 
Java :: how to declare and allocate memory to array in java 
Java :: ORM for Android 
Java :: reponse entity as result spring controller 
Java :: java program for calendar using applet 
Java :: java filter list of dupllicate netries 
Java :: java logger errorAdd Answer 
Java :: struct in java 
Java :: What is sleep() method 
Java :: android ussd code example 
Java :: choose image java 
Java :: java try with multiple resources 
Java :: java nested for loop 
Java :: Caused by: android.view.InflateException: Binary XML file line 
Java :: java break statement 
Java :: binary search program in java 
Java :: junit maven dependency 
Java :: java to c++ converter 
Java :: javadoc link 
Java :: java get class by string name 
Java :: Mila Kunis 
Java :: how to extract image from server url and store it in a folder in java 
Sql :: stop mysql service ubuntu 
Sql :: mysql list bigger table 
Sql :: sql server get utc date 
Sql :: could not find driver (SQL: PRAGMA foreign_keys = ON;) 
Sql :: alembic.util.exc.CommandError: Target database is not up to date. 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =