Install log formatter in glassfish

拥有回忆 提交于 2019-12-19 08:20:08

问题


I don´t like the output of the com.sun.enterprise.server.logging.UniformLogFormatter which might be uniform but not very helpful. So in a first step I just replaced it with the java.util.logging.SimpleFormatter. This actually works fine but for a java.lang.ClassCastException exception:

java.lang.ClassCastException: java.util.logging.SimpleFormatter cannot be cast to com.sun.enterprise.server.logging.UniformLogFormatter

Being a perfectionist I want to get rid of this exception and I wonder if I can create my own child class from com.sun.enterprise.server.logging.UniformLogFormatter and somehow install this class into glassfish.

How to install a custom log formatter into Glassfish?


回答1:


Have a look at Configuring format of server log on the GlassFish forums. Basically, you need to:

  • Implement your formatter
  • Put the jar with your formatter in domain_dir/lib/ext.
  • Declare it in <mydomain>/config/logging.properties

See also

  • Configuring Logging


来源:https://stackoverflow.com/questions/3880452/install-log-formatter-in-glassfish

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!