Arquillian TomEE Remote log format


Arquillian TomEE Remote is pretty awesome but sometimes the logging format used (production oriented since that’s TomEE) is not so readable for test.

Here how to make it more JUnit friendly;)

The idea is simple: provide a custom logging.properties configuration.

How to do it?

First add in your arquillian.xml the property conf:

<property name="conf">src/test/tomee/conf</property>

Then create a logging.properties in src/test/tomee/conf:

handlers = java.util.logging.ConsoleHandler

.handlers = java.util.logging.ConsoleHandler

java.util.logging.ConsoleHandler.level = INFO

# example using default tomcat formatter
# java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter

# trunk only
java.util.logging.ConsoleHandler.formatter = org.apache.tomee.arquillian.remote.SimpleTomEEFormatter

To get one line logs you can use org.apache.juli.OneLineFormatter from tomcat-juli.

If yo use TomEE trunk, org.apache.tomee.arquillian.remote.SimpleTomEEFormatter is available and is close to OpenEJB embedded log format.

Here what it looks like running through maven surefire plugin:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.superbiz.projectstage.DevProjectStageTest
23 oct. 2012 22:48:38 org.apache.openejb.arquillian.common.Setup findHome
INFO: Unable to find home in: /home/a185558/Development/Apache/openejb-trunk/examples/projectstage-demo/target/tomee-remote
23 oct. 2012 22:48:38 org.apache.openejb.arquillian.common.MavenCache getArtifact
INFO: Downloading org.apache.openejb:apache-tomee:LATEST:zip:webprofile please wait...
23 oct. 2012 22:48:38 org.apache.openejb.arquillian.common.Zips unzip
INFO: Extracting '/home/a185558/Development/Apache/openejb-trunk/examples/projectstage-demo/target/org/apache/openejb/apache-tomee/LATEST/apache-tomee-LATEST-webprofile.zip' to '/home/a185558/Development/Apache/openejb-trunk/examples/projectstage-demo/target/tomee-remote'
23 oct. 2012 22:48:39 org.apache.tomee.arquillian.remote.RemoteTomEEContainer configure
INFO: Downloaded container to: /home/a185558/Development/Apache/openejb-trunk/examples/projectstage-demo/target/tomee-remote/apache-tomee-webprofile-1.5.1-SNAPSHOT
INFO - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/dev/java/jdk1.6.0_33/jre/lib/i386/server:/usr/dev/java/jdk1.6.0_33/jre/lib/i386:/usr/dev/java/jdk1.6.0_33/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
INFO - Initializing ProtocolHandler ["http-bio-20001"]
INFO - Initializing ProtocolHandler ["ajp-bio-20003"]
INFO - Using 'openejb.jdbc.datasource-creator=org.apache.tomee.jdbc.TomEEDataSourceCreator'
INFO - Optional service not installed: org.apache.tomee.webservices.TomeeJaxRsService
INFO - Optional service not installed: org.apache.tomee.webservices.TomeeJaxWsService
INFO - ********************************************************************************
INFO - OpenEJB http://openejb.apache.org/
INFO - Startup: Tue Oct 23 22:48:42 CEST 2012
INFO - Copyright 1999-2012 (C) Apache OpenEJB Project, All Rights Reserved.
INFO - Version: 4.5.1-SNAPSHOT
INFO - Build date: 20121023
INFO - Build time: 09:44
INFO - ********************************************************************************
INFO - openejb.home = /home/a185558/Development/Apache/openejb-trunk/examples/projectstage-demo/target/tomee-remote/apache-tomee-webprofile-1.5.1-SNAPSHOT
INFO - openejb.base = /home/a185558/Development/Apache/openejb-trunk/examples/projectstage-demo/target/tomee-remote/apache-tomee-webprofile-1.5.1-SNAPSHOT
INFO - Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@b68e0e
INFO - Succeeded in installing singleton service
INFO - openejb configuration file is '/home/a185558/Development/Apache/openejb-trunk/examples/projectstage-demo/target/tomee-remote/apache-tomee-webprofile-1.5.1-SNAPSHOT/conf/tomee.xml'
INFO - Using 'openejb.provider.default=org.apache.tomee'
INFO - Configuring Service(id=Tomcat Security Service, type=SecurityService, provider-id=Tomcat Security Service)
INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=My DataSource, type=Resource, provider-id=Default JDBC Database)
INFO - Configuring Service(id=My Unmanaged DataSource, type=Resource, provider-id=Default JDBC Database)
INFO - Configuring Service(id=My Singleton Container, type=Container, provider-id=Default Singleton Container)
INFO - Configuring Service(id=My Stateful Container, type=Container, provider-id=Default Stateful Container)
INFO - Configuring Service(id=My Stateless Container, type=Container, provider-id=Default Stateless Container)
INFO - Using 'openejb.system.apps=true'
INFO - Configuring enterprise application: null
INFO - Using openejb.deploymentId.format '{ejbName}'
INFO - Auto-deploying ejb openejb/User: EjbDeployment(deployment-id=openejb/User)
INFO - Auto-deploying ejb openejb/Deployer: EjbDeployment(deployment-id=openejb/Deployer)
INFO - Auto-deploying ejb openejb/ConfigurationInfo: EjbDeployment(deployment-id=openejb/ConfigurationInfo)
INFO - Auto-deploying ejb MEJB: EjbDeployment(deployment-id=MEJB)
INFO - Enterprise application "openejb" loaded.
INFO - Creating TransactionManager(id=Default Transaction Manager)
INFO - Creating SecurityService(id=Tomcat Security Service)
INFO - Creating Resource(id=My DataSource)
INFO - Creating Resource(id=My Unmanaged DataSource)
INFO - Creating Container(id=My Singleton Container)
INFO - Creating Container(id=My Stateful Container)
INFO - Using directory /home/a185558/Development/Apache/openejb-trunk/examples/projectstage-demo/target/tomee-remote/apache-tomee-webprofile-1.5.1-SNAPSHOT/temp for stateful session passivation
INFO - Creating Container(id=My Stateless Container)
INFO - Assembling app: openejb
INFO - Using 'openejb.jndiname.format={deploymentId}{interfaceType.openejbLegacyName}'
INFO - Jndi(name=openejb/UserBusinessRemote) --> Ejb(deployment-id=openejb/User)
INFO - Jndi(name=global/openejb/openejb/User!org.apache.openejb.assembler.util.User) --> Ejb(deployment-id=openejb/User)
INFO - Jndi(name=global/openejb/openejb/User) --> Ejb(deployment-id=openejb/User)
INFO - Jndi(name=openejb/DeployerBusinessRemote) --> Ejb(deployment-id=openejb/Deployer)
INFO - Jndi(name=global/openejb/openejb/Deployer!org.apache.openejb.assembler.Deployer) --> Ejb(deployment-id=openejb/Deployer)
INFO - Jndi(name=global/openejb/openejb/Deployer) --> Ejb(deployment-id=openejb/Deployer)
INFO - Jndi(name=openejb/ConfigurationInfoBusinessRemote) --> Ejb(deployment-id=openejb/ConfigurationInfo)
INFO - Jndi(name=global/openejb/openejb/ConfigurationInfo!org.apache.openejb.assembler.classic.cmd.ConfigurationInfo) --> Ejb(deployment-id=openejb/ConfigurationInfo)
INFO - Jndi(name=global/openejb/openejb/ConfigurationInfo) --> Ejb(deployment-id=openejb/ConfigurationInfo)
INFO - Jndi(name=MEJB) --> Ejb(deployment-id=MEJB)
INFO - Jndi(name=global/openejb/MEJB!javax.management.j2ee.ManagementHome) --> Ejb(deployment-id=MEJB)
INFO - Jndi(name=global/openejb/MEJB) --> Ejb(deployment-id=MEJB)
INFO - Existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@b68e0e
INFO - OpenWebBeans Container is starting...
INFO - Adding OpenWebBeansPlugin : [CdiPlugin]
INFO - Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
INFO - All injection points are validated successfully.
INFO - OpenWebBeans Container has started, it took 122 ms.
INFO - Created Ejb(deployment-id=openejb/Deployer, ejb-name=openejb/Deployer, container=My Stateless Container)
INFO - Created Ejb(deployment-id=MEJB, ejb-name=MEJB, container=My Stateless Container)
INFO - Created Ejb(deployment-id=openejb/ConfigurationInfo, ejb-name=openejb/ConfigurationInfo, container=My Stateless Container)
INFO - Created Ejb(deployment-id=openejb/User, ejb-name=openejb/User, container=My Stateless Container)
INFO - Started Ejb(deployment-id=openejb/Deployer, ejb-name=openejb/Deployer, container=My Stateless Container)
INFO - Started Ejb(deployment-id=MEJB, ejb-name=MEJB, container=My Stateless Container)
INFO - Started Ejb(deployment-id=openejb/ConfigurationInfo, ejb-name=openejb/ConfigurationInfo, container=My Stateless Container)
INFO - Started Ejb(deployment-id=openejb/User, ejb-name=openejb/User, container=My Stateless Container)
INFO - Deployed MBean(openejb.user.mbeans:application=openejb,group=org.apache.openejb.assembler.monitoring,name=JMXDeployer)
INFO - Deployed Application(path=openejb)
INFO -   ** Bound Services **
INFO -   NAME                 IP              PORT  
INFO - -------
INFO - Ready!
INFO - Initialization processed in 3918 ms
INFO - Importing a Tomcat Resource with id 'UserDatabase' of type 'org.apache.catalina.UserDatabase'.
INFO - Creating Resource(id=UserDatabase)
INFO - Démarrage du service Catalina
INFO - Starting Servlet Engine: Apache Tomcat/7.0.32
INFO - Déploiement du répertoire /home/a185558/Development/Apache/openejb-trunk/examples/projectstage-demo/target/tomee-remote/apache-tomee-webprofile-1.5.1-SNAPSHOT/webapps/tomee de l'application web
INFO - -------------------------
....
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s