我正在努力使用该Vertx软件包。所有记录都将通过Vertx(io.vertx.core.logging.Logger)完成
今天,我可以使用vertx-default-jul-logging.properties文件注销到文件。我一直坚持的是这三件事。(是的,我一直在线阅读大量文档。我只需要看到一个可靠的工作属性文件,上面写的东西就可以了)1.如何指定多个输出文件,所以一些文件转到mmddyy class.method.log和mmddyy audit.log的第二个文件
如何控制内容的输出,使日志的格式为{“ yy-MM-dd”} [%-5level]%class {15}。%M:%L-%msg%n
您可以向我指向的任何可靠资源都提供了一些有关在此vertx-default-jul-logging.properties文件中编写适当内容的教程,因为我花了很多时间在此上并且不认为应该花这么长时间得到。
感谢你的帮助。
您应该先阅读官方文档中的一小章http://vertx.io/docs/vertx-core/java/#_logging。重要的是要看到它可以说明,即使JUL是默认设置,如果您愿意,也可以使用任何其他日志记录框架:
vert.x logger类提供的只是一个抽象,无论代码中隐藏了下面的内容,并且如果您想要更改它,都无需更改代码。
如果您仍想使用JUL,则可以在config上配置日志格式:
# here you specify who's going to handle the logs
# for this example I'll use only the console
handlers=java.util.logging.ConsoleHandler
# now you specify the format
java.util.logging.SimpleFormatter.format=%5$s %6$s\n
# and now you tell the console to use that format
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
Run Code Online (Sandbox Code Playgroud)
这些是配置的基础,为了控制格式,在此处指定了语法http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax