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.
To monitor the log file (e.g. server. log) you can use the tail -f command in this case Linux / Cygwin. It is real-time reading the log and with Ctrl + C command you can close the tail -f command and not lose any of your data (you can open it again with any text editor). Note: path/jboss-eap-6.0/standalone/log/server.
jboss.server.base.dir/configuration. jboss.server.data.dir. The directory used for persistent data file storage.
The conf directory contains the jboss-service. xml bootstrap descriptor file for a given server configuration. This defines the core services that are fixed for the lifetime of the server. The data directory is available for use by services that want to store content in the file system.
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 etc
You can also get this through ServerConfig.getServerLogDir()
(on JBoss 4.x, anyway), but you said you wanted to avoid JAR dependencies.
You could use a custom log implementation. This would give you complete control over the logging behavior.
JBoss uses Log4j as its logging mechanism. WebSphere uses Jakarta Commons Logging, which can be configured to delegate to Log4j if it isn't already the default. If you already use Log4j in your application then I don't expect that this difference will cause you any new problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With