I have enabled logback-access log for Tomcat 7.0, using LogbackValve. My logback-access config looks like this.
<configuration>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>access.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>access.%d{yyyy-MM-dd}.log.zip</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>combined</pattern>
</encoder>
</appender>
<appender-ref ref="FILE" />
</configuration>
Now this works perfect and I can see access logs. But in some other code I want to retrieve the appender configured in logback-access.xml programmatically. Is there a way to do it. Since there are no Loggers defined , you cannot use LoggerContext .