1

I would like to log all actions(especially the connectivity related ones) from my mssql-jdbc driver.

I tried to follow these instructions, but without luck.

I tried to create a new logger.properties file on my desktop

included -Djava.util.logging.config.file=C:\Users\myUser\Desktop\logging.properties in my jvm.options file.

Put these parameters in the logging.properties file

handlers = java.util.logging.FileHandler
.level = OFF
java.util.logging.FileHandler.pattern= %h/java%u.log
java.util.logging.FileHandler.limit= 5000000
java.util.logging.FileHandler.count= 20
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level = FINEST
com.microsoft.sqlserver.jdbc.level = FINEST

From here i was under the impression it would log all jdbc activities to a .log file in my userhome directory. But it doesn't.

What am I doing wrong here? Or are there any other ways to log jdbc activity?

Andy Guibert
  • 41,446
  • 8
  • 38
  • 61
mTv
  • 1,074
  • 17
  • 28
  • 1
    Is Websphere running under your user account? If not, it won't have access to your user directory. – Mark Rotteveel Mar 07 '18 at 12:49
  • Right. How could i change the default logging directory? Perhaps i should also change the location of my logging.properties file? – mTv Mar 07 '18 at 12:56
  • 1
    Yes to both. And changing the logging location should be a matter of changing that `java.util.logging.FileHandler.pattern` value. – Mark Rotteveel Mar 07 '18 at 13:03
  • Alright, thanks. Gonna try that now. – mTv Mar 07 '18 at 13:06
  • Do the paths have to be in a specific location for the Websphere server to see/write to them?. Right now i just put them in my wlp install dir. C:/ibm/wlp. Didn't work:S – mTv Mar 07 '18 at 13:27

1 Answers1

1

According to the following WebSphere Liberty knowledge center document you can configure java.util.logging for the Microsoft SQL Server JDBC driver in bootstrap.properties as follows,

com.ibm.ws.logging.trace.specification=*=audit=enabled:com.microsoft.sqlserver.jdbc=FINE

The output will end up in the WebSphere liberty trace logs, which have a default location of [liberty-server-location]/logs/trace.log

njr
  • 3,399
  • 9
  • 7
  • Sweet, this seems to get the logging working. But i couldn't get the details i was looking for though. Do you know if I'm able to get details about which ciphers(TLS 1.0, TLS 1.2 etc.) the driver attempts to use with the sql server? – mTv Mar 07 '18 at 16:26
  • 1
    Not sure what the driver has in terms of SSL tracing, but I think you could just use generic SSL trace for that. Set `-Djavax.net.debug=all` in a jvm.options file, which you can create at the same level as the server.xml for that server. The output will be in the WebSphere Liberty log files, both messages.log and trace.log. Warning though, that does tend to add quite a bit of output. – Alex Motley Mar 07 '18 at 18:26
  • 1
    Never mind, doing `com.ibm.ws.logging.trace.specification=*=audit=enabled:com.microsoft.sqlserver.jdbc=` `FINEST` gave me what I was after! – mTv Mar 08 '18 at 08:35