steveohara / j2mod

Enhanced Modbus library implemented in the Java programming language
Apache License 2.0
269 stars 111 forks source link

Request for quick example update for logging #136

Closed dannaughton closed 1 year ago

dannaughton commented 1 year ago

Reqeust for simple update to documentation or example to control log levels.

In on of the example: private static final ModbusLogger logger = ModbusLogger.getLogger(Test.class);

ModbusLogger does not exist.

My modbus slave I created is just filled with debug information - I don't know how to throttle it. Thanks

mkurt commented 1 year ago

Hi, You can change log levels by configuring your logger implementation. If you want less verbosity you can set level to info or higher. Here is an logback config example from my repo: Logback config

steveohara commented 1 year ago

j2mod uses sl4j which is a façade on top of whatever your favourite logger is that you're using in your application. As mkurt suggested, logback is a good one, so is log4j2 and there are others. That is where you would manage the log settings.