4646import java .util .Set ;
4747
4848/**
49- * <a href="https://logback.qos.ch/">Logback</a> appender for StackDriver Cloud Logging.
49+ * <a href="https://logback.qos.ch/">Logback</a> appender for Google Cloud Logging.
5050 *
51- * <p>Appender configuration in logback.xml:
51+ * <p>Appender configuration in <code> logback.xml</code> :
5252 *
53- * <ul>
54- * <li><appender name="CLOUD" class="com.google.cloud.logging.logback.LoggingAppender">
55- * <li><log>application.log</log> (Optional, defaults to "java.log" : Stackdriver log
56- * name)
57- * <li><level>ERROR</level> (Optional, defaults to "INFO" : logs at or above this
58- * level)
59- * <li><flushLevel>WARNING</flushLevel> (Optional, defaults to "ERROR")
60- * <li><resourceType></resourceType> (Optional, auto detects on App Engine Flex,
61- * Standard, GCE and GKE, defaults to "global". See <a
62- * href="https://cloud.google.com/logging/docs/api/v2/resource-list">supported resource
63- * types</a>
64- * <li><credentialsFile>/path/to/credentials/file</credentialsFile> (Optional,
65- * defaults to the default credentials of the environment)
66- * <li>(Optional) add custom labels to log entries using {@link LoggingEnhancer} classes.
67- * <li><enhancer>com.example.enhancer1</enhancer>
68- * <li><enhancer>com.example.enhancer2</enhancer>
69- * <li></appender>
70- * </ul>
53+ * <pre>
54+ * <appender name="CLOUD" class="com.google.cloud.logging.logback.LoggingAppender">
55+ * <!-- Optional: filter logs at and above this level -->
56+ * <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
57+ * <level>INFO</level>
58+ * </filter>
59+ *
60+ * <!-- Optional: defaults to "java.log" -->
61+ * <log>application.log</log>
62+ *
63+ * <!-- Optional: defaults to "ERROR" -->
64+ * <flushLevel>WARNING</flushLevel>
65+ *
66+ * <!-- Optional: auto detects on App Engine Flex, Standard, GCE and GKE, defaults to "global". See <a
67+ * href="https://cloud.google.com/logging/docs/api/v2/resource-list">supported resource types</a> -->
68+ * <resourceType></resourceType>
69+ *
70+ * <!-- Optional: defaults to the default credentials of the environment -->
71+ * <credentialsFile>/path/to/credentials/file</credentialsFile>
72+ *
73+ * <!-- Optional: add custom labels to log entries using {@link LoggingEnhancer} classes -->
74+ * <enhancer>com.example.enhancers.TestLoggingEnhancer</enhancer>
75+ * <enhancer>com.example.enhancers.AnotherEnhancer</enhancer>
76+ * </appender>
77+ * </pre>
7178 */
7279public class LoggingAppender extends UnsynchronizedAppenderBase <ILoggingEvent > {
7380
@@ -89,8 +96,8 @@ public class LoggingAppender extends UnsynchronizedAppenderBase<ILoggingEvent> {
8996 private String log ;
9097 private String resourceType ;
9198 private String credentialsFile ;
92- private Set <String > enhancerClassNames = new HashSet <>();
93- private Set <String > loggingEventEnhancerClassNames = new HashSet <>();
99+ private final Set <String > enhancerClassNames = new HashSet <>();
100+ private final Set <String > loggingEventEnhancerClassNames = new HashSet <>();
94101
95102 /**
96103 * Batched logging requests get immediately flushed for logs at or above this level.
0 commit comments