我们需要从我们的Web应用程序中显示JBoss日志文件。 没有使用ServerConfigLocator,可以实现这一点吗? 应用程序必须能够使用Websphere运行,并且我们不希望依赖于特定的JAR。
We need to display JBoss log files from within our web application. Is it possible to achieve this without using ServerConfigLocator ? The application must be able to run also with Websphere and we don't want dependencies on specific JARs.
最满意答案
JBoss定义的日志目录保存在jboss.server.log.dir系统属性中。 您可以将该目录解析为java.io.File ,并读取其中的文件。
File logDir = new File(System.getProperty("jboss.server.log.dir")); logDir.list(); // etc etc你也可以通过ServerConfig.getServerLogDir() (无论如何,在JBoss 4.x上)获得,但是你说你想避免JAR依赖。
JBoss's defined log directory is held in the jboss.server.log.dir system property. You can resolve that directory to a java.io.File, and read the files inside.
File logDir = new File(System.getProperty("jboss.server.log.dir")); logDir.list(); // etc etcYou can also get this through ServerConfig.getServerLogDir() (on JBoss 4.x, anyway), but you said you wanted to avoid JAR dependencies.
如何获取JBoss日志目录(How to get JBoss log directory)我们需要从我们的Web应用程序中显示JBoss日志文件。 没有使用ServerConfigLocator,可以实现这一点吗? 应用程序必须能够使用Websphere运行,并且我们不希望依赖于特定的JAR。
We need to display JBoss log files from within our web application. Is it possible to achieve this without using ServerConfigLocator ? The application must be able to run also with Websphere and we don't want dependencies on specific JARs.
最满意答案
JBoss定义的日志目录保存在jboss.server.log.dir系统属性中。 您可以将该目录解析为java.io.File ,并读取其中的文件。
File logDir = new File(System.getProperty("jboss.server.log.dir")); logDir.list(); // etc etc你也可以通过ServerConfig.getServerLogDir() (无论如何,在JBoss 4.x上)获得,但是你说你想避免JAR依赖。
JBoss's defined log directory is held in the jboss.server.log.dir system property. You can resolve that directory to a java.io.File, and read the files inside.
File logDir = new File(System.getProperty("jboss.server.log.dir")); logDir.list(); // etc etcYou can also get this through ServerConfig.getServerLogDir() (on JBoss 4.x, anyway), but you said you wanted to avoid JAR dependencies.
发布评论