Appender

The appender configuration section is what manages the log file. I've added comments to the appender for puppetserver.log, concerning what the individual lines are doing:

<!-- Setting the name for future reference and making a Rolling Log File -->
<appender name="F1" class="ch.qos.logback.core.rolling.RollingFileAppender">

<!-- Logging to /var/log/puppetlabs/puppetserver/puppetserver.log -->
<file>/var/log/puppetlabs/puppetserver/puppetserver.log</file>

<!-- Appending to, not replacing the log -->
<append>true</append>

<!-- Roll the file over based on Size and Time -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">

<!-- What to name the file as it's rolled over, with date variables -->
<fileNamePattern>/var/log/puppetlabs/puppetserver/puppetserver-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>

<!-- Maximum size of log file before rolling over -->
<maxFileSize>200MB</maxFileSize>

<!-- Maximum Number of Files to keep - 90 logs -->
<maxHistory>90</maxHistory>

<!-- Maximum Filesize of all files that will be kept. Up to 5 files with 200 MB -->
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<!-- What to print for date and time with the message -->
<encoder>
<pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX} %-5p [%t] [%c{2}] %m%n</pattern>
</encoder>
</appender>

In the preceding example, we're creating puppetserver.log with a rollover strategy. We'll keep up to 90 logs, but we'll rotate whenever a log reaches 200 MB in size, and we will delete logs if we have more than 1 GB of logs. We'll append the date to logs that we roll over, and we will print the timestamp from the log.

You may see an appender to STDOUT. This actually prints to System.out and System.error, essentially appending to the Terminal.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.210.17