How to write to the logging of the server?

Tags: #<Tag:0x00007f70b19962d0>

If you have written an extension for i-net Clear Reports and you want write to the central log file of the server then you can use the following code:

import com.inet.logging.*;

static final Logger LOGGER = LogManager.getLogger( "MyPlugin" );
LOGGER.error( "my error message " );
LOGGER.debug( new Exception() );

For the name of the logger it is recommended to use the name of your plugin or application. The name is visible in the log file and in the Configuration manager GUI in the “Logging” category, once you switch to a customized log level. Theoretically, you could use the names of already existing loggers, but this is not recommended. The logger name is case-sensitive. You should use the same spelling if you use the logger on different places.

The logger is only visible in the configuration manager if your code has requested it at least once. For this reason, it is recommended to create an instance of the logger as soon as possible after the server startup, rather than to lazily create the logger only in an error case.

The API is in the inetcore.jar. You need to add a reference if you does not have it.

© Copyright 1996 - 2018, i-net software; All Rights Reserved.