ThingWorx Edge Java SDK > Application Details > Configuring Logging with logback.xml
Configuring Logging with logback.xml
The configuration of logging using logback requires that you put a logback.xml file on the classpath of the application. An example is presented below, but the configuration of the logback.xml file is beyond the scope of this document. It is recommended that you reference the sites mentioned in Logging for more information. A sample file, called logback-template.xml, is provided in the /samples/resources subdirectory of the Java SDK installation.
The package entered below for logging, com.mycompany, needs to be modified to the name of the package that contains the and files.
The following example of the configuration in logback.xml is provided for demonstration purposes:
<!-- Create an appender for standard out using the following format
DateTime [L: LEVEL] [O: class] [T: Thread] message -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<pattern>%date{yyyy-MM-dd HH:mm:ss.SSSZ} [L: %level] [O: %logger{8}] [T: %thread]
<!-- Create an appender that will write to a file named
/SteamSensor/Logs/SteamSensor.log. The file will roll
over daily and be named /SteamSensor/Logs/SteamSensor-<date>.0.log
The file will roll over after it reaches 100 MB and be named
/SteamSensor/Logs/SteamSensor-<date>.<count>.log with the following format
DateTime [L: LEVEL] [O: class] [T: Thread] message
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.
<!-- or whenever the file size reaches 100MB -->
<pattern>%date{yyyy-MM-dd HH:mm:ss.SSSZ} [L: %level] [O: %logger{8}]
[T: %thread] %msg%n%rootExceptionpattern>%date{yyyy-MM-dd HH:mm:ss.SSSZ}
[L: %level] [O: %logger{8}] [T: %thread] %msg%n%rootException>

<!-- Log the SteamSensor at TRACE level -->
<logger name="com.mycompany" level="TRACE">>/logger>
<!-- Log all classes in the com.ThingWorx namespace at ERROR level -->
<logger name="com.ThingWorx" level="ERROR"></logger>
<!-- Set the default log level to WARN and log to the standard output and to a file -->
<root level="WARN">
<appender-ref ref="STDOUT" />
<appender-ref ref="ROLLING" />