Hi,

JBossAS7 provides “jboss-as-7.1.1.Final/bin/client/jboss-client.jar” file which need to be placed on the client side while interacting with JBoss like remoting/ ejb/jms…etc. But when we run a client with the help of this Jar file the we see a lots of unnecessary logging on the client side which creates some confusion and pulls unnecessary attention, So here in this article we will see how to avoid these client side Logging or How to control these client side loggging which interacting with JBossAS7.1.1.Final

Default Client side Logging while invoking a simple EJB on JBossAS7

Usually we see following kind of unnecessary logging on the client side while invoking an EJB or while using jboss remoting on JBossAS7

.
   java  TestEjbClient


   Jun 12, 2012 1:15:43 AM org.xnio.Xnio <clinit>
   INFO: XNIO Version 3.0.3.GA
   Jun 12, 2012 1:15:43 AM org.xnio.nio.NioXnio <clinit>
   INFO: XNIO NIO Implementation Version 3.0.3.GA
   Jun 12, 2012 1:15:43 AM org.jboss.remoting3.EndpointImpl <clinit>
   INFO: JBoss Remoting version 3.2.3.GA
   Jun 12, 2012 1:15:44 AM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
   INFO: Received server version 1 and marshalling strategies [river]
   Jun 12, 2012 1:15:44 AM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
   INFO: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@32dcb03b, receiver=Remoting connection EJB receiver [connection=Remoting connection <7ac2b2f6>,channel=jboss.ejb,nodename=localhost]} on channel Channel ID da49cdbe (outbound) of Remoting connection 4b00ebec to localhost/127.0.0.1:4447
   Jun 12, 2012 1:15:44 AM org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleMessage
   WARN: Unsupported message received with header 0xffffffff
   Jun 12, 2012 1:15:44 AM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
   INFO: Received server version 1 and marshalling strategies [river]
   Jun 12, 2012 1:15:44 AM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
   INFO: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@31ad98ef, receiver=Remoting connection EJB receiver [connection=Remoting connection <16df1832>,channel=jboss.ejb,nodename=localhost]} on channel Channel ID 97e5a096 (outbound) of Remoting connection 31b5998f to localhost/127.0.0.1:4447
   Jun 12, 2012 1:15:44 AM org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleMessage
   WARN: Unsupported message received with header 0xffffffff
     
     	--------------------------
   Got initial Context: javax.naming.InitialContext@2cf18e8e
   remote.testMethod("MiddlewareMagic") = [CallerBean] testMethod() returned Hello MiddlewareMagic
.

Steps to Control JBossAS7 Client Side Logging

Step-1) Create a file with name “logging.properties” somewhere in your filesystem like “/home/userone/logging.properties” following:

# Logging
handlers =  java.util.logging.ConsoleHandler
.level = ALL
INFO
 
# Console Logging
java.util.logging.ConsoleHandler.level=SEVERE

NOTE: Based on your requirement you can choose the Logging level as java.util.logging.ConsoleHandler.level= CONFIG, INFO, WARNING, SEVERE, ALL and OFF

Step-2) Now while running your Client program make sure that you use the following JAVA_OPTIONS ” -Djava.util.logging.manager=java.util.logging.LogManager -Djava.util.logging.config.file=/home/userone/logging.properties”

Example:
=========

.
  java   -Djava.util.logging.manager=java.util.logging.LogManager    -Djava.util.logging.config.file=/home/userone/logging.properties  TestEjbClient

     
   --------------------------
   Got initial Context: javax.naming.InitialContext@2cf18e8e
   remote.testMethod("MiddlewareMagic") = [CallerBean] testMethod() returned Hello MiddlewareMagic
.

.
.
Thanks
Middleware Magic Team 🙂

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.