Is it possible to have two or more log files for different purposes? For instance, I want to log regular notifications and messages to one file and errors to another file? I saw how to create multiple connections but I think that sends every message to all connections?
Yes, that’s possible and you can use the following configuration for this:
file(filename=..), file(filename=.., level=error)
This will create two file-based connections: the first one will receive all log messages and the second one will only add log messages of level error or higher to the log file. Is this what you are looking for?
I will look into this and see if it would work, but not exactly what I was thinking. I typically used 4 logs - (1) the main log having everything that will go into production, (2) a test or debug log I used for output specifically related to designing/programming. This was to make my life easier rather than having to dig through the main log for specific output, (3) an error log that logged errors, that was also emailed, (4) a statistics log that would output certain statistics to a CSV for external analysis (this relates to my other question).
If I want to use SmartInspect maybe I would need to rethink how i use logs.
Thanks for your reply. An alternative would be to use different SmartInspect and Session objects. You can then easily use different sessions/files depending on the log context (e.g. debug/production/errors, etc) and this would be more flexible than the log level filter per connection. Using the log level filter (and same SmartInspect instance) is usually sufficient though and should also cover your scenario.