Hi,<br><br>I am new to logback but if I am understanding your problem correctly, can following solve it for you?<br><br>- create a log file appender targeting the log message to /logs/foo. <br>- create a logger with logger name matching the package of source code which is associated with or called for the creation of foo entity <br>
- associate this logger to the file appender created in the earlier step. <br>This way all the logs in the package related to foo will go inside a file at log/foo. If you only specific log related to entity creation and all other log statements in that package to go into log/foo you can make use of filters on those file appenders, so it will filter out those specific statements bases on some criteria like log message, log level etc.<br>
I am not sure if you still need to close the logger.<br><br>- Pradnya<br><br><br><br><div class="gmail_quote">On Wed, Sep 22, 2010 at 2:48 PM, Chris <span dir="ltr">&lt;<a href="mailto:shef31@yahoo.com">shef31@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">My app needs to create log files on the fly and put them in their own directories. For example, suppose a user creates a new entity in our system named &quot;foo&quot;. We want to create a new subdirectory, /logs/foo, and put foo-related events there. When the user is done with foo, we need to close the logger and release resources.<br>

<br>
How can I do this with logback?<br>
<br>
The difficulty is that we can&#39;t know in advance the name of the logger or the filename it needs to use, so we can&#39;t configure it in logback.xml.<br>
<br>
<br>
Also, it doesn&#39;t look like Logger has a close() method, so even if I write a custom Appender, I don&#39;t know how I&#39;d notify it to shut down. I&#39;d prefer to use generic slf4j in the application itself.<br>
<br>
<br>
<br>
_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a><br>
<a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
</blockquote></div><br>