---
title: "Logging for DataSync Agent"
canonical: "https://docs.perspectium.com/space/helium/2114614/Logging%20for%20DataSync%20Agent"
format: markdown
---
To set the logging level at the command line you can enter in the appropriate command for your agent version. At the command line you can set the logging level for a certain duration or indefinitely. You can also   manually   set the logging level.    NOTE : Setting it manually will set it indefinitely. It can be helpful to have the logging set to  FINEST/DEBUG  during installation but it is recommended to have logging set to  INFO  during production. Dynamically Setting the Logging Version By default, the logging level of the DataSync agent is set at   INFO . This setting incurs minimal logging and is a good candidate for every day use. The logging level can be dynamically changed using the   setLogging   command. This command is useful during troubleshooting to obtain greater detail of the processing taking place. You may be asked to increase the logging level to finest by using the setLogging command. The setLogging command has the following syntax: setLogging LOGGING_LEVEL DURATION The  LOGGING_LEVEL  argument is required and must be either  finest ,  info , or  debug . The  DURATION  argument is used to specify how many   seconds   the change in logging level is to remain in affect. The default is one hour and by setting it to -1 it will remain indefinitely. Typically the logging level is changed to finest only during troubleshooting so the default value ensures that info level debugging is resumed after an hour. For example you can call the following commands from the root Perspectium directory: # Setting to finest logging for an hour
bin/setLogging finest
 
# Setting to finest logging for 3 hours (10800 seconds) 
bin/setLogging finest 10800
 
# Setting to info logging indefinitely
bin/setLogging info -1    NOTE : T his is will stay in affect until the  DataSync Agent is restarted or the duration expires. Manually Setting the Logging Level You can manually set the logging level by editing a single line of the config. Log into the host that the agent is installed on and navigate to the home directory of the Agent and edit the   log4j2.xml  file within the   conf   folder. Change the property   <Root level="debug">  to the desired logged level:   info ,   debug , or   finest . By default the Agent is configured with   info   but like the setLogging command, can be changed to different levels to aid in troubleshooting. The levels are the same, with finest providing the most detail and info provides the least. Save the file and restart the agent to implement the change. This will stay in affect through Agent restarts until it is modified back. You can still modify the logging level through the previous   bin/setLogging   command above. Additional Configurations There are additional changes you can make to alter the logs specific to different databases and libraries used by the Agent to aid in troubleshooting.   The file   logging.properties   within the   conf   folder contains information and examples for such changes. Database Debugging To enable debugging logs for I/O through the JDBC of MSSQL you can append the following to the end of  logging.properties  in the Agent's  conf  folder. 1) Create a  logging.properties  file in the  conf  folder if it does not exist, creating it with the following content: # Specify the handler, the handlers will be installed during VM startup.  
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
  
# Default global logging level.  
.level= OFF  
  
java.util.logging.FileHandler.pattern = ../logs/perspectium.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  
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.level = FINEST
 2) Add the following to the bottom of the  logging.properties  file: com.microsoft.sqlserver.jdbc.level = FINEST For example: # Specify the handler, the handlers will be installed during VM startup.  
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
  
# Default global logging level.  
.level= OFF  
  
java.util.logging.FileHandler.pattern = ../logs/perspectium.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  
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.level = FINEST
  
# Facility specific properties.  
com.microsoft.sqlserver.jdbc.level = FINEST 3) Open the  wrapper.conf  file in the  conf  folder and verify you have a  wrapper.java.additional.#  entry that points to the  logging.properties  file. For example an entry such as  wrapper.java.additional.1=-Djava.util.logging.config.file=../conf/logging.properties wrapper.java.additional.1=-Djava.util.logging.config.file=../conf/logging.properties
wrapper.java.additional.2=-Dlog4j.configurationFile=../conf/log4j2.xml
#wrapper.java.additional.3=-Dfile.encoding=UTF-8 If you do not have an entry similar to  wrapper.java.additional.1=-Djava.util.logging.config.file=../conf/logging.properties , add one at the end of the wrapper.java.additional configuration section, incrementing to the next number not being used and ensuring there isn't a  #  in front of the line. The  #  will comment out that line so that it's not active. In the above example, if there was no entry for  wrapper.java.additional.1=-Djava.util.logging.config.file=../conf/logging.properties , we would add it as: wrapper.java.additional.3=-Djava.util.logging.config.file=../conf/logging.properties So it can be the third entry added since there already exists entries for 1 and 2 and the current 3 entry is not being used. 4)  (Windows Only)  If the Agent is installed on Windows, open up the  agent.bat  in the Agent's  bin  folder and add the  -Djava.util.logging.config.file="%~dp0..\conf\logging.properties"  argument after the -Dlog4j.configurationFile="%~dp0..\conf\log4j2.xml" argument. That is, change this block from: IF [%1]==[maxHeap] (
    SET JAVA_ARGS=-Xmx%2 -Dlog4j.configurationFile="%~dp0..\conf\log4j2.xml" -classpath "%~dp0..\jars\*";"%~dp0..\extlib\*" com.perspectium.replicator.Replicator
) else (
    SET JAVA_ARGS=-Dlog4j.configurationFile="%~dp0..\conf\log4j2.xml" -classpath "%~dp0..\jars\*";"%~dp0..\extlib\*" com.perspectium.replicator.Replicator
) To This: IF [%1]==[maxHeap] (
    SET JAVA_ARGS=-Xmx%2 -Dlog4j.configurationFile="%~dp0..\conf\log4j2.xml" -Djava.util.logging.config.file="%~dp0..\conf\logging.properties" -classpath "%~dp0..\jars\*";"%~dp0..\extlib\*" com.perspectium.replicator.Replicator
) else (
    SET JAVA_ARGS=-Dlog4j.configurationFile="%~dp0..\conf\log4j2.xml" -Djava.util.logging.config.file="%~dp0..\conf\logging.properties" -classpath "%~dp0..\jars\*";"%~dp0..\extlib\*" com.perspectium.replicator.Replicator
) 5) Restart the Agent and you should see start seeing MS SQL JDBC logs in this format:  FINEST: TDSCommand@281ae0e3 (SQLServerPreparedStatement:111 executeXXX): request complete To enable additional logging for Snowflake's  JDBC driver , you can configure your  agent.xml  as follows:  <database_parms Tracing=CONFIG/> <database_parms Tracing=FINEST/> <database_parms Tracing=ALL/> Where  ALL  will provide the most detailed level of additional logging. See  tracing=<string>  for more information on the different logging levels available. A tmp log file will be created. See  How to generate log file on Snowflake connectors .  To enable this  Snowflake Meshlet , you can configure your connection url in the  application.yml  with one the following:  jdbc:snowflake://xxxxxx.snowflakecomputing.com/?TRACING=CONFIG jdbc:snowflake://xxxxxx.snowflakecomputing.com/?TRACING=ALL jdbc:snowflake://xxxxxx.snowflakecomputing.com/?TRACING=FINEST To enable debugging logs for MySQL, you can configure your  agent.xml  with the following:  <database_parms>characterEncoding=UTF-8&logger=com.mysql.cj.log.StandardLogger&profileSQL=true</database_parms> See  MySQL configuration properties . To enable debugging logs for Postgres, you can configure your  agent.xml  with one the following:  <database_parms>loggerLevel=TRACE&loggerFile=pgjdbc.log</database_parms>  <database_parms>loggerLevel=DEBUG&loggerFile=pgjdbc.log</database_parms>  See  Logging using java.util.logging . To enable debugging logs for I/O through the JDBC of Oracle you can configure the   logging.properties  with the following: oracle.level=ALL
oracle.jdbc.driver.level=ALL
oracle.jdbc.pool.level=ALL
oracle.jdbc.util.level=ALL
oracle.sql.level=ALL
oracle.jdbc.handlers=java.util.logging.FileHandler

java.util.logging.FileHandler.level=ALL
java.util.logging.FileHandler.pattern=%h/jdbc4.log 
java.util.logging.FileHandler.count=1
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
oracle.handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter Can't find what you're looking for?     See  the FAQ  or browse the  Perspectium Community Forum .