Hi, I am new to logback but if I am understanding your problem correctly, can following solve it for you?
- create a log file appender targeting the log message to /logs/foo. - create a logger with logger name matching the package of source code which is associated with or called for the creation of foo entity - associate this logger to the file appender created in the earlier step. 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. I am not sure if you still need to close the logger. - Pradnya On Wed, Sep 22, 2010 at 2:48 PM, Chris <[email protected]> wrote: > 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 "foo". 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. > > How can I do this with logback? > > The difficulty is that we can't know in advance the name of the logger or > the filename it needs to use, so we can't configure it in logback.xml. > > > Also, it doesn't look like Logger has a close() method, so even if I write > a custom Appender, I don't know how I'd notify it to shut down. I'd prefer > to use generic slf4j in the application itself. > > > > _______________________________________________ > Logback-user mailing list > [email protected] > http://qos.ch/mailman/listinfo/logback-user >
_______________________________________________ Logback-user mailing list [email protected] http://qos.ch/mailman/listinfo/logback-user
