Microsoft Azure Open Source Development Support Team Blog

Support for Open Source Technologies on Microsoft Azure App Service

Logging SQL Server JDBC driver operations for Java application related cloud service

To enable the logging of JDBC driver, please follow these steps –

1. Select your cloud service on Azure portal and open the Instances tab.

2. Select the instance and click on the connect button to initiate the remote desktop session.


3. You can use the existing file from default location or you can create a new one and use it for logging.


Using the existing default file –

1. Once you log in to your virtual machine, open the file explorer and traverse to JRE/lib in your environment.

2. You should find the file. Just open it and edit it according to your logging needs. Sample properties file shown below.


Using your own file –

1. Create a new and place in the folder of your choice. Make sure the folder has required permission for access.

2. Add the JVM parameter “-Djava.util.logging.config.file=<drive>:<your folder path>/” in your server configuration for launching.


After enabling these settings, you should see logs on console or a new log file is getting generated in your specified directory (default directory is your home directory. eg C:\Users\<your login name>\), depending on the handler that you enabled in the properties file.


Sample file (Log file related settings are highlighted) –  

# The set of handlers to be loaded upon startup.

# Comma-separated list of class names.

handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler


# Default global logging level.

# Loggers and Handlers may override this level



# Loggers

# ——————————————

# Loggers are usually attached to packages.

# Here, the level for each package is specified.

# The global level is used by default, so levels

# specified here simply act as an override.

# myapp.ui.level=ALL


# Handlers

# —————————————–

# — ConsoleHandler —

# Override of global logging level



# — FileHandler —

# Override of global logging level



# Naming style for the output file:

# (The output file is placed in the directory

# defined by the “user.home” System property.)



# Limiting size of output file in bytes:



# Number of output files to cycle through, by appending an

# integer to the base file name:



# Style of output (Simple or XML):




Sample Output –  

May 14, 2015 3:22:18 PM parseUrl
FINE: Property:serverName Value:<your Server name>
May 14, 2015 3:22:18 PM parseUrl
FINE: Property:portNumber Value:1433
May 14, 2015 3:22:18 PM parseUrl
FINE: Property:databaseName Value:<your db name>
May 14, 2015 3:22:18 PM parseUrl
FINE: Property:encrypt Value:true
May 14, 2015 3:22:18 PM parseUrl
FINE: Property:hostNameInCertificate Value:*.net
May 14, 2015 3:22:18 PM parseUrl
FINE: Property:loginTimeout Value:30
May 14, 2015 3:22:18 PM <init>
FINE: ConnectionID:1 created by (SQLServerDriver:1)
May 14, 2015 3:22:18 PM login
FINE: ConnectionID:1 This attempt server name: <your Server name> port: 1433 InstanceName: null useParallel: false
May 14, 2015 3:22:18 PM login
FINE: ConnectionID:1 This attempt endtime: 1431634968867
May 14, 2015 3:22:18 PM login
FINE: ConnectionID:1 This attempt No: 0
May 14, 2015 3:22:18 PM connectHelper
FINE: ConnectionID:1 Connecting with server: <your Server name> port: 1433 Timeout slice: 30000 Timeout Full: 30
May 14, 2015 3:22:19 PM Prelogin
FINE: ConnectionID:1 ClientConnectionId: e655dbf0-203e-4700-8b46-36a5de29039f Server returned major version:11