Default Logger Handler Overriding via System Properties

Hello,

I am attempting to override the DefaultHandler.class, which is present as the root logger’s default handler in the ej.util.logging library. From my understanding, this should technically be possible by including a *.properties.list and a *.types.list file, which both point to a new Handler which I am providing.

The two files I have created are residing in the src/main/resources folder of my library, and include the following:

log.properties.list:
handlers=package.name.SilentHandler

log.types.list:
package.name.SilentHandler

Despite adding these files, when I acquire the property in the library I am developing via System.getProperty(“handlers”), it still returns DefaultHandler.class (and consequently, the class is being used by the ej.util.logging library). I have also tried adding these files directly into the project at which the developed library is being imported, but it still was not being overridden.

Is there a step that I am missing, or a different way of going about achieving this goal?

As a side note, the .jar for the MicroEj logging library seems to have a logging.system.properties file within it. I am wondering if this may be contributing to the issue of not being able to override the property value.

Thank you very much,
Matthew

Hi Mattew,

The logging.system.properties file name is the old naming convention, but is still compatible.

Adding a properties.list file in the application project is the correct way of doing.

If you add it in your library, you will be dependent on the last loading of the logging library that may override your property.

However, you are telling that putting the property file is not working, are you using a standalone platform or a virtual device?

Regards,

Pierre

Hello Pierre,

I am currently using a virtual device.

If I am dependent on the last loading of the logging library, is there inherently a race condition present which determines what properties file will be used? Is there a way to 100% ensure that my properties file will be the one that is referenced when the System.getProperty(“handlers”) call is made?

Thanks,
Matthew

Hello Matthew,

When using a virtual device the system properties are set when building the Kernel.so you should set in in your kernel.

Regards,