We have ported an EJB application from BEA Weblogic 8.1 to Glassfish 2.1.
The client is accessing the server through RMI, no web client.
In Weblogic exceptions were logged automatically to server.log, even when they are catched and rethrown to the client.
In Glassfish with default configuration we can't see them in server.log.
How can I get the same behavior as with Weblogic?
Glassfish 2.1 logs via java.util.logging. Logging content, by default, is collected in
[Glassfish root]/domains/[domain name]/logs/server.log
For configuring j.u.l, find the logging.properties file in the JRE that is used to run Glassfish (in the lib directory), set your topics' (loggers') levels to desired granularity.
Note: that worked for me for an application using Apache Commons Logging, running on Glassfish.
Related
I have previously asked the question here on stackoverflow on how to get web lookups to work in log4j2 (See log4j2 Web Lookup not working). Eventually, the question was answered and all was fine. Now, when I got it working, the web apps were all Spring 4 based apps using log4j 2.2 jars running on Tomcat 5.0.57 containers.
Now however, we have almost the same setup as before (i.e Spring 4 on Tomcat 5.0.57 containers) with the exception that, the log4j jars have now been updated to log4j v2.5 jars. With log4j v2.5 jars the web lookups are still working when deployed on Windows Tomcat 5.0.57 containers but, NO LONGER on linux Tomcat 5.0.57 containers.
On our linux Tomcat containers the log files are now being created as: ${web:contextPath}.log instead of actually replacing the lookup variable with the deployment's context path name.
What has changed since log4j v2.2 that may cause web lookups to stop working?
I have tried several logging frameworks (log4j / slf4j with logback/ commons-logging) on websphere to redirect each application log on a separate file, without any sucess.
If i have two applications deployed on same JVM: I am not able to know related errors of each application: All non catched exceptions gets redirected to SystemOut.log file, instead of getting redirected to the appropriate application log file.
Is there any way to achieve that on websphere ?
It would be useful if you post the configuration files you've tried for each logging framework, and provide more details of each scenario. I have used log4j and logback with WebSphere and never ran into problems like yours.
My Java EE application, which currently runs on Glassfish 3, is currently using java.util.logging to send logmessages. This is intercepted by Glassfish and written to files.
I'd like to switch to a centralised logging solution, since the application is going to be distributed in a cluster.
I have an existing syslog infrastructure. Do you have any suggestion, how to get the application to log to syslog? Glassfish's log-to-syslog feature has no documentation and no configuration, so I haven't considered it much.
What about migrating to SLF4J and using the SLF4J syslog appender?
Please have a look a look at Glassfish to Syslog which shows how to let GlassFish 3 log to system log/syslog via UDP 514 on localhost.
This might be duplicate of this and this question.
I have a java application in which i am using JAX-WS (WEB SERVICES). and many other features in it like apache-commons utils.
My application is swing application, that connects to my server code
and uploads and downloads, and sync files with the server. my
database is mysql.
I have compiled my server code and created a .WAR file. i deployed
that .WAR (containing all the required libraries for my server
side application) file on a JBoss server and its working fine.
Now my Management says me to why use JBoss instead of Tomcat, which
easy to manage and setup on a linux server. actualy they have a
linux server which supports tomcat, but not JBoss. so they said to
me to deploy on Tomcat on Linux Server. I installed and configured
tomcat on my windows and deployed a .WAR file. and also created
virtual directory for my resources its working fine[but not tested
completely]
My Application does not have EJB so I think that Tomcat is good enough.
Please suggest me is it fine to use Tomcat instead of JBoss server,
I am worried if it may get problems in the future, or it might not
support features of my application in future or after complete testing.
JBoss uses Tomcat under the hood to host war applications anyway.
Using Tomcat for you war application instead of JBoss should be perfectly fine.
Any commons-jars that you are using can be downloaded from http://commons.apache.org/. Put them in your lib directory and you should be good to go. Most apache commons libraries should allready be included with Tomcat though, you'll have to check.
PS:
JAX-WS is standard in the latest JDK6 updates. If your using a earlier version of the JDK then just download the JAX-WS jars. The standard reference implementation from Oracle/Sun can be downloaded from here http://jax-ws.java.net/
Do you have EJB? JBoss comes with its implementation of the EJB JSR specification.
For Tomcat, you require plugins like openEJB.
Many application servers use Tomcat internally as its Servlet container. But for compliance to JavaEE standards, most would choose a JBoss application server over Tomcat anyday.
Note that JBoss 7 Application Server Web Profile is certified.
Tomcat functions well as a plain vanilla Servlet container. Many enterprises when using Tomcat, couple it with Proxy and HTTPD servers for security and load balancing reasons.
I have a quite ordinary web application which logs with slf4j, which is fine, and I have used several slf4j backends without any problems.
Under Tomcat I just told logback to point at a location in the filesystem and log there, but now I want to deploy several independent instances of this application each in its own domain in a single Glassfish 3.0.1 instance, and I have now found that I would like my slf4j logging to work well with Glassfish.
What would be a good way (dare I say "best") to have my logging taken care of by Glassfish. Should I just flatten my logs to System.out with logback and let Glassfish handle the console output, or is there a better, standard way to reach the loggers inside Glassfish?
EDIT: Investigation has shown that GlassFish 3.0.1 does not provide neither the SLF4J API or a binding in the classes visible to a JSP-page with default configuration.
By providing slf4j-api-X.jar and slf4j-jdk14-X.jar the slf4j-logging events are forwarded to java.util.logging which is captured properly by Glassfish (see http://docs.sun.com/app/docs/doc/820-7692/abluj?l=en&a=view for details).
Investigation has shown that GlassFish 3.0.1 does not provide neither the SLF4J API or a binding in the classes visible to a JSP-page with default configuration.
By providing slf4j-api-X.jar and slf4j-jdk14-X.jar the slf4j-logging events are forwarded to java.util.logging which is captured properly by Glassfish (see http://docs.sun.com/app/docs/doc/820-7692/abluj?l=en&a=view for details).
Note: Glassfish logging does not capture stack traces.