Logging and Log Files
Log Files
When analyzing the behaviour of the CData Virtuality Server to trace activities or perform debugging, we recommend to look at the log files in the CData Virtuality Server's directory. There is one log file that contains all the information from the last Server startup and another file that writes all queries and errors. The files and their location are as follows:
Operating system | Location | Best practice location |
---|---|---|
Linux | %pathToDVserver%/standalone/log/boot.log %pathToDVserver%/standalone/log/server.log | /opt/datavirtuality/dvserver/standalone/log/boot.log /opt/datavirtuality/dvserver/standalone/log/server.log |
Windows | %pathToDVserver%\standalone\log\boot.log %pathToDVserver%\standalone\log\server.log | C:\Program Files(x86)\datavirtuality\dvserver\standalone\log\boot.log C:\Program Files(x86)\datavirtuality\dvserver\standalone\log\server.log |
boot.log
Some typical information that you can get from the boot.log file is:
- Connections used for the configuration databases, if different from H2;
JAVA_HOME
system environment variable in use;- Java runtime, which the server runs on;
- The machine's hostname and Fully Qualified Domain Name (FQDN);
- Several important directories being used;
- Memory settings of the Java Virtual Machine;
- and many more.
Below we give some sample lines extracted from boot.log:
...
dv.dvconfig.ds = dvconfigs_pg
dv.dvconfig.schema = dvconfig
dv.dvconfig.type = psql
dv.dvlogs.ds = dvconfigs_pg
dv.dvlogs.schema = dvlogs
dv.dvlogs.type = psql
...
java.home = C:\Program Files\Java\jdk1.7.0_60\jre
...
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.7.0_60-b19
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.7
...
jboss.host.name = dv-pc
...
jboss.node.name = dv-pc
jboss.qualified.host.name = dv-pc
...
jboss.server.log.dir = C:\Program Files(x86)\datavirtuality\dvserver\standalone\log
...
VM Arguments: -XX:+TieredCompilation -Dprogram.name=standalone.bat -Xrs -Xms8192M -Xmx8192M -XX:MaxPermSize=512M -XX:MaxDirectMemorySize=6g ...
The server from the sample uses a PostgreSQL DBMS to host the two configuration databases. The connection for this is named dvconfigs_pg
. The JAVA_HOME
can be found, and the running Java version is Java 7 Update 60, which is from Oracle. You can also see that the name of the server's host machine is dv-pc
, and it does not belong to a domain (i.e., it does not belong to an environment that uses Directory Services like Active Directory or OpenLDAP). Lastly, the extract shows the path to the server.log file. The meaning of the memory setting is explained in mode detail in Memory Configuration.
server.log
This file logs all actions performed by the CData Virtuality Server, as well as all commands sent to the Server and possible errors that occurred. Typical information in the log concerns connection timeouts, valid licenses, and many more. Like all other popular DBMS, the CData Virtuality Server uses an SQL statement for all operations. The advantage is that you can track all the modifications that might have been made to the Server options, optimization jobs, or additional flags used when a statement was executed. This information is also visible in the query log, which you can access via the CCData Virtuality Studio, but server.log has stored information regarding the CData Virtuality Server, and you can use tools like Tail or FarManager to watch the log live. This is useful if you want to or have to audit server actions.
server.log is mostly used for troubleshooting. While the CData Virtuality Studio only gives an error message after a failed query run, you have the stack trace in server.log to check all the errors that preceded the message displayed, and you can also follow the errors that do not come with an error message. When your connection to the internal database cannot be established, for example, the Server will be unavailable, and there will be no messages in the Studio because it cannot connect to the Server. The log provides this information, and you can start checking the network connection to the DBMS that hosts the configuration database.
Compression of Log Files
To save space occupied by the log files, you can use log compression on rotation using the SYSADMIN.executeCli
system procedure:
- Linux:
CALL SYSADMIN.executeCli('/subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=suffix, value=".yyyy-MM-dd.gz")');;
- Windows:
CALL SYSADMIN.executeCli('/subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=suffix, value=".yyyy-MM-dd.zip")');;
Logging in JSON
The CData Virtuality Server has the possibility to write logs in the JSON format. There are two ways to do it: using the executeCLI system procedure or manually by editing the dvserver-standalone.xml file in the urn:jboss:domain:logging:8.0 subsystem.
Using the executeCLI System Procedure
You can run the following statements:
CALL SYSADMIN.executeCli(script => '/subsystem=logging/json-formatter=JSON:add(pretty-print=true, exception-output-type=formatted)') ;;
CALL SYSADMIN.executeCli(script => '/subsystem=logging/periodic-rotating-file-handler=FILE-JSON:add(file={"relative-to"=>"jboss.server.log.dir", path=server.json}, suffix=".yyyy-MM-dd", append=true, autoflush=true, named-formatter=JSON)') ;;
CALL SYSADMIN.executeCli(script => '/subsystem=logging/root-logger=ROOT:add-handler(name=FILE-JSON)') ;;
Editing the dvserver-standalone.xml File
Change the dvserver-standalone.xml file as follows:
1. Add the JSON formatter:
<formatter name="JSON">
<json-formatter pretty-print="true">
<exception-output-type value="formatted"/>
</json-formatter>
</formatter>
<periodic-rotating-file-handler name="FILE-JSON" autoflush="true">
<formatter>
<named-formatter name="JSON"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.json"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
<handler name="FILE-JSON"/>
</handlers>
</root-logger>
System Procedures for Logging
The CData Virtuality Server has two special system procedures: SYSADMIN.logMsg
and SYSADMIN.isLoggable
. For detailed information on them, please refer to the dedicated section of our Management API Guide.