<html>
<body>
<br>
Greetings,<br><br>
I have a servlet app which responds to HTTP requests. Each request
initiates (sometimes lengthy) processing that I would like to log to its
own uniquely named log file. This request log file should be
separate from the servlet's log file so that request-based log statements
aren't interleaved w/ each other making them hard to follow. What
approach should I use for this? <br><br>
I am relatively new to Logback. I have used programmatically
instantiated appenders in log4j to do this in the past. For
Logback, I have created separate configuration files for the servlet and
request log, and tried invoking a reset of the context and doConfigure()
on the Joran Configurator once when the servlet initiates, and then again
processing each request (based on a to-the-millisecond date
pattern). Doing this causes the servlet's log messages to go into
the request log.<br><br>
Clearly I'm doing something wrong. ere are the configuration
files that I'm using, the first for the servlet, the second for the
request logging. Perhaps these need to be combined into one
file? If so, how can I get a separate log file for each request as
its processed?<br><br>
<font face="Courier New, Courier"><!-- servlet logging config file
--><br>
<?<u>xml</u> version="1.0"
encoding="UTF-8"?><br>
<configuration scan="true" scanPeriod="30
seconds"><br>
<appender name="CostingServlet"
class="<u>ch</u>.<u>qos</u>.<u>logback</u>
.core.rolling.RollingFileAppender"><br>
<!--See also
http://logback.qos.ch/manual/appenders.html#RollingFileAppender--><br>
<File>\\host\app\logs\<u>costingservlet</u>.log</File><br>
<layout
class="<u>ch</u>.<u>qos</u>.<u>logback</u>
.classic.PatternLayout"><br>
<Pattern>%-17d{<u>yyyy</u>-MMM-<u>dd</u> HH:mm} %-6r [%t] %-6p
%c{3} - %m%n</Pattern><br>
</layout><br>
<rollingPolicy
class="<u>ch</u>.<u>qos</u>.<u>logback</u>
.core.rolling.FixedWindowRollingPolicy"><br>
<maxIndex>10</maxIndex><br>
<FileNamePattern>\\host\app\logs\<u>costingservlet</u>
.log.%i</FileNamePattern><br>
</rollingPolicy><br>
<triggeringPolicy
class="<u>ch</u>.<u>qos</u>.<u>logback</u>
.core.rolling.SizeBasedTriggeringPolicy"><br>
<MaxFileSize>2MB</MaxFileSize><br>
</triggeringPolicy><br>
</appender><br>
<logger name="com.<u>bearlogic</u>.<u>servlets</u>"
level="DEBUG"/><br>
<root level="debug"><br>
<appender-<u>ref</u>
<u>ref</u>="CostingServlet"/><br>
</root><br>
</configuration><br><br>
<!-- request logging config file --><br>
<?<u>xml</u> version="1.0"
encoding="UTF-8"?><br>
<configuration scan="true" scanPeriod="30
seconds"><br>
<timestamp key="byMilliSecond"
datePattern="yyyyMMMdd'T'HHmmssSSSS" /><br>
<appender name="FILE"
class="<u>ch</u>.<u>qos</u>.<u>logback</u>
.core.FileAppender"><br>
<File>\\host\app\logs\<u>reqlog</u>
-${byMilliSecond}.log</File><br>
<layout><br>
<Pattern>%-17d{<u>yyyy</u>-MMM-<u>dd</u> HH:mm} %-6r [%t] %-6p
%c{3} - %m%n</Pattern><br>
</layout><br>
</appender><br>
<logger name="com.<u>bearlogic</u>.<u>rc</u>"
level="DEBUG" /><br>
<root level="debug"><br>
<appender-<u>ref</u>
<u>ref</u>="FILE" /><br>
</root><br>
</configuration><br><br>
</font>I've read the manual, browsed through FAQ and searched the user
archives for an answer to this w/o understanding what I should be
doing. I can't be the first to want to do something like
this. Perhaps I need to use a filter of some sort? Any hints
or pointers on this would be greatly appreciated. <br><br>
Thanks in advance,<br><br>
-Albert<br>
</body>
</html>