I need to log all the queries to an Oracle database in my project to a log file.
What would be a good solution to achieve this? Some sample usage would be a
You configure where log messages are written by configuring where the underlying logging engine is sending them. Since you're talking about slf4j, that means you've got to configure the thing that it is bridging to (the java.util.logging
system in your case; called JUL henceforth).
Unfortunately, JUL is among the more confusing systems to configure. Here's where I'll just cut to the chase. Create a file in your deployed classpath called logging.properties
(I think; this is one of the confusing bits) which contains something like this:
handlers=java.util.logging.FileHandler
.level=ALL
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
The documentation on the FileHandler class describes things that you can configure.