我使用嵌入式数据库(plocal)启动我的应用程序。OrientDB版本为2.0 M2。
ODatabasePoolBase<ODatabaseDocumentTx> pool = new ODatabaseDocumentPool("plocal:" + database, getUsername(), getPassword());在我的应用程序中,我使用slf4j和"Log4j 2 SLF4J绑定“进行日志记录。
我在日志文件中看到从我的应用程序中生成的任何日志消息。现在,我希望在同一个日志文件中获取orientdb服务器日志消息,以便进行调试。
到目前为止,我尝试过的(没有成功):
SLF4JBridgeHandler.removeHandlersForRootLogger(); SLF4JBridgeHandler.install();。发布于 2015-07-20 15:05:05
可以通过在类路径中添加jl-to-slf4j来实现日志记录:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>将此添加到初始化代码中
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
java.util.logging.Logger logger = java.util.logging.Logger.getLogger("com.orientechnologies");
logger.setLevel(Level.ALL);现在可以在log4j配置中设置单独日志级别:
<Logger name="com.orientechnologies" level="INFO" />发布于 2015-07-17 20:24:44
OrientDB服务器使用自己的LogFormatter。若要在应用程序调用中使用相同的内容,请执行以下操作:
OLogManager.installCustomFormatter();LogFormatter由服务器自动安装。若要禁用它,请将orientdb.installCustomFormatter设置为false。示例:
java ... -Dorientdb.installCustomFormatter=false=false ...有关更多信息,请参阅正式文档:http://orientdb.com/docs/2.0/orientdb.wiki/Logging.html
https://stackoverflow.com/questions/26506710
复制相似问题