I figured out how to turn on the JDBC logging through code, but it is not in the code our customers are running, and I would like to turn on the JDBC driver logging only with a configuration file. Is this possible? I'm trying a logging.properties file in the same directory as the driver containing # Specify the handlers to create in the root logger # (all loggers are children of the root logger). # The following creates two handlers. handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler # Set the default logging level for the root logger. .level = OFF # Set the default logging level for new ConsoleHandler instances. java.util.logging.ConsoleHandler.level = FINE # Set the default logging level for new FileHandler instances. java.util.logging.FileHandler.level = OFF # Set the default formatter for new ConsoleHandler instances. java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter # Set the default logging level for the logger named ConnectionPool. ConnectionPool.level = OFF # default file output is in user's home directory. java.util.logging.FileHandler.pattern = %h/java%u.log java.util.logging.FileHandler.limit = 50000 java.util.logging.FileHandler.count = 1 java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter ############################################################ # Facility specific properties. # Provides extra control for each logger. ############################################################ # For example, set the com.xyz.foo logger to only log SEVERE # messages: com.microsoft.sqlserver.jdbc.level = ALL I haven't got any output yet. I'm kind of desparate, so any help would be greatly apprceciated.
I'm gong provide an answer to my problem. After some research into the rather widely avoided java.util.Logging package, I got something to work. I edited the logging.properties file in the jre/lib directory where my Tomcat app server was starting. Doing this got the tracing going. I'm sure some others could offer suggestions. On my Windows box, the trace file was create off my home directory, "C:\Documents and Settings\wclark" . The modifications I made to the jre\lib\logging.properties files was: adding # Logging lever for SQL Server com.microsoft.sqlserver.jdbc.level = ALL at the end; uncommenting handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler and modifying java.util.logging.FileHandler.pattern = %h/java%g.log java.util.logging.FileHandler.limit = 0 java.util.logging.FileHandler.count = 0 limt was set to 5000, which means I got 5000 bytes in the file and then it rewrote it. Anyway it worked.