Managing Logging in Windchill+
Windchill+ does not support direct use of the third-party libraries. For logging of customizations in Windchill+ , use the interface wt.log4j.Logger. The class wt.log4j.LogManager returns an instance of the logger. This topic covers the implementation of the wt.log4j.Logger interface. An example of this implementation is given below:
import wt.log4j.LogManager
import wt.log4j.Logger;
public class TestClass
{
private static final String CLASSNAME = TestClass.class.getName();
private static final Logger logger = LogManager.getLogger(CLASSNAME);
public void testMethod()
{
if (logger.isDebugEnabled())
{
logger.debug("In test method");
}
}
}
Follow the given instructions below to implement the logger:
1. Create the Logger interface wt.log4j.Logger. This interface should include the methods to check if logging is enabled for fatal, error, warn, info, debug, trace levels.
2. Write a LogManager that implements the wt.log4j.Logger interface. This class should implement getLogger static APIs. It can include variants of this API.
For more information on the supported APIs, see the Javadoc.
Enabling the logs
Refer to the guidelines as specified below to enable logging in various environments:
Environment
Enabling logs
Method
Development
Logs are enabled at the development site by the user having site administration access.
Logs are enabled from the Monitoring Tools page.
Integration
Logs are enabled at the development site by the user having site administration access.
Logs are enabled from the Monitoring Tools page.
Production and QA
You are required to open a service request.
Logging is enabled by PTC from Monitoring Tools page.
To enable logging, open a service request. Logging is enabled by the PTC team by using either of the following ways:
Monitoring tools page — A user with Site Administration access can enable logging from the Log Levels link on Site > Utilities > Server Status > Monitoring Tools page.
Command line utility — To set or reset logger verbosity levels for specified loggers in specified server processes, use the wt.util.jmx.SetLogLevel command-line utility . For more information on the usage of this utility, see Managing Windchill Logging.
Custom logger are registered in Windchill using log4jMethodServer.properties file. Example of the entry in the file for the custom logger is as seen below:
logger.CustomLogger.name=com.acme.TestLogger
logger.CustomLogger.level=ERROR
Setting the log level
The log level for the OOTB deployments is set as error. Open a service request to change the log level. Do not set the log level using customize Java file. Log the messages in the Windchill method server log file and not in a separate log file.
Segregating Customization Logs and OOTB Logs
Segregate the customization and the OOTB logs using a fixed pattern of the package convention. Following is an example of the package prefix for the user xyz:
"com.xyz.*" or "org.xyz.*"
Was this helpful?