Logging JBoss request/response ONLY using log4j - jboss

How can JBoss requests/responses ONLY be logged using log4j?
For my 3-tiered application (client, web-service and database), I'm trying to gather request/response times.
For instance, timestamps before/after:
Client sends request
WS receives request
WS sends query to database
Currently, my log displays several thousand lines of text (DEBUG mode). But, I'm looking only for request/response information.
I suppose I could choose a different log level, but I'm not able to find my log4j.xml that most solutions are referring to (server/xxx/conf/jboss-log4j.xml). The log4j.properties file in my Eclipse for some reason is not allowing edits.
I'm new to JBoss; in fact inherited the current setup from somebody else, so I'm a little clueless about the entire JBoss thing.
Edit 1
Examples of log4j.properties can be found here.
Edit 2
My log4j.properties:
log4j.rootLogger=TRACE, file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=C\:log4j.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.category.org.springframework.beans.factory=DEBUG

It's probably best to configure logging through the logging subsystem. If you're looking to use your a log4j configuration file, see the instructions here.

Related

Difference between rundeck.audit.events.log and rundeck.audit.log

I updated my rundeck version from 3.4.9 to 4.7.0 in my RHEL8 machine and due to that a new log file has been introduced in the application i.e. "rundeck.audit.events.log". I am trying to figure out what does this file contain that "rundeck.audit.log" does not. So basically, what is the difference between both the log files? Does the new log file contain anything different that other log files don't?
I looked at few articles explaining rundeck.audit.events.log file but it doesn't contain any difference between both the log files.
rundeck.audit.log: Authorization messages pertaining to aclpolicy (more info here).
rundeck.audit.events.log: Logs all auditing events (users logins, logouts, etc..)
More info here.

Log4s log format configuation

How do I configure how the format of the logging output?
E.g. the time format, thread name level etc.
How do I get the following?
17:15:00.154 Main INFO : Here is a log...
log4s is merely a wrapper for slf4j. So its purpose is to provide a logging facade, not an implementation. You'll have to decide which actual logger implementation to use. A popular choice is logback, which you would configure using a logback.xml file. See http://www.slf4j.org/manual.html#swapping and http://logback.qos.ch/manual/configuration.html.

Access to servlet logs on localhost (jetty) when developing app for Google Application engine

I am prototyping an java servlet application using Google application engine. Is there any way how I can access the log4j servlet logs in when testing on localhost? E.g. if I use the Logger class instance and I call log.info("Request comes"); in HttpServlet::doGet() method I would like to use the tail+grep or other tools to analyze the logs during the development. Are those logs saved into some file? If using external tools is not possible I would like to see the logs at least into Eclipse console output.
When the application is deployed into Google (http://appengine.google.com/) cloud I can see my logs via web interface, but I need the access on localhost during the development.
Log4j is easily configurable, I guess you know that you need to add `log4j.properties' into your classpath, etc? Other way, it have good documentation, see Configuration block.
If you need to put log into file, just add:
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.file=/path/to/logfile.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.conversionPattern=%d{ABSOLUTE} %5p %t %c{1}:%M:%L - %m%n
where /path/to/logfile.log if log you can tail+grep
To put it into eclipse console (I guess it's just a console output), you have to add:
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.conversionPattern=%d{ABSOLUTE} %5p %t %c{1}:%M:%L - %m%n
and don't forget about adding this appenders into an logger, for example into root logger:
log4j.rootLogger=INFO, stdout, file

Change log file name during runtime - ent lib

I have a WCF service that will serve multiple clients. I'm using ent lib for the logging.
I'd like to have a different log file for each client. is there a way to change the file name back and forth?
I found a few threads but they all talk about editing the config file during runtime.
ALso found this: Enterprise Library Logging but it talks about environment variables. I will set the log name according to the client id.
Thanks
Avi
You can have distinct categories linked to individually configured FlatFile or RollingFile tracelisteners for each client.
If filenames are unknown till runtime, consider using fluent API for configuration, like so:
http://msdn.microsoft.com/en-us/library/ff664363(PandP.50).aspx#fluent_api_logging

Binding a queue to an EJB 3.0 MDB in WebSphere 7

I'm writing, or trying to write, Baby's First MDB on WebSphere 7. I have nearly no hair left, having pulled it all out trying to get the thing to work. It appears that I've got everything set up right, but I get no response when I put a message to the associated queue.
Here's the EAR file setup:
simplemdb.ear
META-INF
Manifest.mf
application.xml
simplemdb.jar
META-INF
Manifest.mf
ejb-jar.xml
com
[ classes go here ]
I can't find any syntax for defining the queue's JNDI name in ejb-jar.xml, so instead I:
Define a WebSphere activation spec. Name SimpleMDBActivationSpec, JNDI name jms/SimpleActivationSpec, Destination jms/SimpleMDBQueue.
Define a WebSphere queue. Name SimpleMDBQueue, JNDI name jms/SimpleMDBQueue, Queue name SIMPLE.MDB.QUEUE.
Define an MQ queue, name SIMPLE.MDB.QUEUE.
Deploy the EAR file. During the deployment, I'm asked to enter binding information. I select Activation Specification, then point the Target Resource JNDI Name and Destination JNDI name at the activation spec and queue, respectively.
(The MDB code has no annotations.) At this point, the app points to the spec and queue, and the spec points to the queue - belt and suspenders. Naturally, I imagine that the app therefore knows about the queue. Full of hope, I put a message on the queue, and ... nothing. The onMessage event is supposed to use System.out to log a message. I see no message.
Clear documentation on this is conspicuous by its absence. Google gives LOTS of results, but none of them details how the configuration all fits together. There's lots of hand-waving about ibm-ejb-jar-bnd.xmi, but examples of the file are arcane, full of opaque numbers with no explanation about how they were generated, or how they relate to other parts of the configuration.
For goodness' sake. All I want to do is deploy an MDB, and have it write "Hello, world" when I put a message to a queue. I'm using vi and ant as my development and build tools. Can anybody out there give me an idea about what I'm missing?
Edit: "zos" tag added.
I found the problem. It's specific to WebSphere running on z/OS. For an activation spec to be fully available in that environment, the Control Region Adjunct (CRA) process must be started. I told WAS to start it up, recycled the app server, and lo! My MDB started responding.
To make the CRA start via the WebSphere Admin Console, go to ...
Application servers > [server name] > Communications > Messaging > WebSphere MQ CRA Settings
... and check the box that says "Start CRA". Hit OK, save it to the master configuration, and to make the CRA actually start, bring the app server down and back up. (This is for WAS 7.0.)
Thanks to everyone for their time and thoughtspace.
have a quick look at this and see if there is anything here that helps you.
http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.wasfpejb/wasfpejb/6.1/DevelopmentTools/WASv61_EJB3FP_MDBLab.pdf
I haven't played with this for the last one year so i am not able to comment straight away but i thought the PDF might be of some assistance to you.
HTH
Manglu