Logging to external syslog server

Answered

Comments (1)

  • Avatar
    admin
    Hi Morris,

    In fact, the CloverDX is already using the log4j2 apache logging platform. Therefore, the Designer is by default using the original log4j2.xml file stored on the workspace level. In order to use a customized version, you have to tell the system to use a different configuration file instead. It can be done by adding a system property
    -Dlog4j.configurationFile=path/to/log4j2.xml with a path to your customized version of the file. You can find more details about this topic on the Server related documentation page https://doc.cloverdx.com/latest/server/logging.html.

    The most important fact is that you can't actually use two different log4j2.xml files at once, but the new one completely overrides the one shipped with CloverDX. It is, therefore, best to copy out and modify the original configuration shipped with CloverDX.

    The documentation covers the setups in case you are working with CloverDX Server, so please let me add some details that should help you achieve the same goal in CloverDX Designer (Local Project).

    Location of the Log4j2 configuration file is:
    workspace_home_folder/.metadata/.plugins/com.cloveretl.gui.runtime/runtime-deploy/webapp/WEB-INF/log4j2.xml
    (in Windows, workspaces are by default in C:/Users/UserName/)

    System property has to be added to the CloverDXDesigner.ini file located in:
    CloverDX Designer/CloverDXDesigner.ini
    (in Windows, C:/Program Files/CloverDX Designer/)

    To create the customized log message as you have it in your example, I have done the following:

    1. I have copied the log4j2.xml file from C:\Users\Evka\workspace\workspace581\.metadata\.plugins\com.cloveretl.gui.runtime\runtime-deploy\webapp\WEB-INF\log4j2.xml and stored it in ${PROJECT}/trans folder

    2. I have updated the newly created file and added my own Appender into it (honestly, I have just copied one of the existing appenders in the file and just changed the name to "myAppender" updated the pattern and location of the log file)

    3. Then I added the new logger:
    <Logger name="SyslogLogger" level="info" additivity="false">
    <AppenderRef ref="myAppender" />
    </Logger>

    Please note that the name of the logger is the java class created in your CustomJavaComponent.

    4. I have then added the system property at the end of the CloverDXDesigner.ini file, the property in my example looks as follows:
    -Dlog4j.configurationFile=file:///c:\Users\Evka\workspace\LocalProject\trans\log4j2.xml


    5. Then I restarted the Runtime. (In the left bottom corner of the Designer there is the status of runtime - usually "Ready" - click on the arrow next to it and choose Restart Runtime. Or you can also quit the Designer and open it again.)
    Run your graph.

    Please give this a try and let us know if it works for you. Thanks, Eva
    0
    Comment actions Permalink

Please sign in to leave a comment.