1 2 Previous Next 18 Replies Latest reply on Dec 7, 2012 11:28 AM by James Perkins

    How can I show my exception in console

    nuhsoah Newbie

      Hi guys,

           I am using jboss 7.1, and I am new to jboss. When I changed to use jboss 7.1.1 in my project, I found the log is out of my control. The most serious is I can't see my Hibernate query exception log in console. Anybody can give some advice?

      I found the following log setting in D:/jboss-as-7.1.1.Final/standalone/configuration/standalone.xml, the root logger level is INFO.

      <subsystem xmlns="urn:jboss:domain:logging:1.1">

                  <console-handler name="CONSOLE">

                      <level name="INFO"/>

                      <formatter>

                          <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>

                      </formatter>

                  </console-handler>

                  <periodic-rotating-file-handler name="FILE">

                      <formatter>

                          <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>

                      </formatter>

                      <file relative-to="jboss.server.log.dir" path="server.log"/>

                      <suffix value=".yyyy-MM-dd"/>

                      <append value="true"/>

                  </periodic-rotating-file-handler>

                  <logger category="com.arjuna">

                      <level name="WARN"/>

                  </logger>

                  <logger category="org.apache.tomcat.util.modeler">

                      <level name="WARN"/>

                  </logger>

                  <logger category="sun.rmi">

                      <level name="WARN"/>

                  </logger>

                  <logger category="jacorb">

                      <level name="WARN"/>

                  </logger>

                  <logger category="jacorb.config">

                      <level name="ERROR"/>

                  </logger>

                  <root-logger>

                      <level name="INFO"/>

                      <handlers>

                          <handler name="CONSOLE"/>

                          <handler name="FILE"/>

                      </handlers>

                  </root-logger>

              </subsystem>

        • 1. Re: How can I show my exception in console
          Wolf-Dieter Fink Master

          Hi Eric,

           

          do you see the message in the server.log?

          How do you start the server, which OS?

          • 2. Re: How can I show my exception in console
            erasmo2 marciano2 Master

            You can see the Exception in Java if in your web-apps you wrote this eg.

             

            try {

                  divisione = operazioni.divisione(5,0);

                  System.out.println("Il risultato della divisione è:" + divisione);

                }

             

                catch (Exception exc) {

                  System.out.println(exc);

                  System.out.println("Non puoi effettuare una divisione per zero");

                }

            • 3. Re: How can I show my exception in console
              Wolf-Dieter Fink Master

              Use of system.out will not be a good idea for a server application.

              There are different drawbacks with synchronisation in this case.

              • 4. Re: How can I show my exception in console
                erasmo2 marciano2 Master

                Certainly.

                I think so too.

                is only an example, there are a lot way for to write a log file

                • 5. Re: How can I show my exception in console
                  Wolf-Dieter Fink Master

                  If so you should add a statement, otherwise it might be used as 'best practice' and the next issue is a question regarding the poor performance of the server!

                  • 6. Re: How can I show my exception in console
                    nuhsoah Newbie

                    Wolf-Dieter,

                         Sorry for my late reply. I can't see the exception server.log too. I am using win7 and I start jboss using the standalone.bat under %JBOSS_HOME%/bin. Most strangely, I can see other log messages when jboss start up. like,

                     

                    09:05:47,827 INFO  [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-3) Choosing bean (struts) for (com.opensymphony.xwork2.util.PatternMatcher)
                    09:05:47,827 INFO  [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-3) Choosing bean (struts) for (org.apache.struts2.dispatcher.StaticContentLoader)
                    09:05:47,827 INFO  [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-3) Choosing bean (struts) for (com.opensymphony.xwork2.UnknownHandlerManager)
                    09:05:47,827 INFO  [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-3) Choosing bean (struts) for (org.apache.struts2.views.util.UrlHelper)
                    09:05:47,827 INFO  [com.opensymphony.xwork2.config.impl.DefaultConfiguration] (MSC service thread 1-3) Overriding property struts.i18n.reload - old value: false new value: true
                    09:05:47,827 INFO  [com.opensymphony.xwork2.config.impl.DefaultConfiguration] (MSC service thread 1-3) Overriding property struts.configuration.xml.reload - old value: false new value: true
                    09:05:47,827 INFO  [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-3) Loading global messages from resource.ApplicationResource
                    09:05:47,844 INFO  [org.apache.struts2.spring.StrutsSpringObjectFactory] (MSC service thread 1-3) Initializing Struts-Spring integration...
                    09:05:47,844 INFO  [com.opensymphony.xwork2.spring.SpringObjectFactory] (MSC service thread 1-3) Setting autowire strategy to name
                    09:05:47,844 INFO  [org.apache.struts2.spring.StrutsSpringObjectFactory] (MSC service thread 1-3) ... initialized Struts-Spring integration successfully
                    09:05:48,280 INFO  [org.jboss.web] (MSC service thread 1-3) JBAS018210: Registering web context: /cynthia
                    09:05:48,280 INFO  [org.jboss.as] (MSC service thread 1-3) JBAS015951: Admin console listening on http://127.0.0.1:9990
                    09:05:48,280 INFO  [org.jboss.as] (MSC service thread 1-3) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 15016ms - Started 295 of 372 services (76 services are passive or on-demand)
                    09:05:48,358 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "cynthia.war"

                     

                    I am using spring + jpa + hibernate + struts2 in my application, and I can also see the log struts print out.

                     

                    09:07:28,251 INFO  [org.apache.struts2.views.velocity.VelocityManager] (http--127.0.0.1-8080-2) Initializing velocity using D:\jboss-as-7.1.1.Final\standalone\deployments\cynthia.war\WEB-INF\velocity.properties from file system
                    09:07:28,486 WARN  [org.apache.struts2.util.TextProviderHelper] (http--127.0.0.1-8080-2) The first TextProvider in the ValueStack (org.gdis.cynthia.accesscontrol.action.LoginAction) could not locate the message resource with key 'login.user'
                    09:07:28,486 WARN  [org.apache.struts2.util.TextProviderHelper] (http--127.0.0.1-8080-2) The default value expression 'login.user' was evaluated and did not match a property.  The literal value 'login.user' will be used.
                    09:07:28,486 WARN  [org.apache.struts2.util.TextProviderHelper] (http--127.0.0.1-8080-2) The first TextProvider in the ValueStack (org.gdis.cynthia.accesscontrol.action.LoginAction) could not locate the message resource with key 'login.login'
                    09:07:28,486 WARN  [org.apache.struts2.util.TextProviderHelper] (http--127.0.0.1-8080-2) The default value expression 'login.login' was evaluated and did not match a property.  The literal value 'login.login' will be used.

                     

                    But when my application throws exception, I can't see the exception log in console.

                    • 7. Re: How can I show my exception in console
                      Wolf-Dieter Fink Master

                      How your application code look like?

                      Do you log the Exception? Is it a RuntimeException?

                      Do you see other log messages from your application?

                       

                      AFAIK a simple Exception is, depend on your code, not handled by the container and might be not logged automaticaly.

                      • 8. Re: How can I show my exception in console
                        nuhsoah Newbie

                        Hi Wolf,

                             I am using jboss 7.1.1.Final, and my application contains log4j.jar in WEB-INF/lib and log4j.properties under WEB-INF.

                             I found the struts2 configuration exception was sent to the front page, and the exceptions thrown out by struts2 Action could be turned on by setting the EXCEPTION interceptor. I had resolves these two issues. Now, my problem is about Hibernate4.1.6. When Hibernate exception threw, I could not see the debug log message, even I had turn down the log4j logger level to DEBUG. The following is my log4j.properties,

                         

                        # Set The RootLogger
                        log4j.rootLogger=debug, stdout, file

                        # Direct Log Messages To Console
                        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{yyyy-MM-dd HH:mm:ss} %p %c:%L - %m%n

                        # Direct Log Messages To file
                        log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
                        log4j.appender.file.File=cynthia.log
                        log4j.appender.file.DatePattern='.'yyyy-MM-dd
                        log4j.appender.file.layout=org.apache.log4j.PatternLayout
                        log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %t %5p %c{1}: - %m%n

                        # Log Hibernate
                        log4j.logger.org.hibernate=debug
                        log4j.logger.org.hibernate.SQL=debug
                        log4j.logger.org.hibernate.tool.hbm2ddl=warn

                         

                         

                        I had searched answer in google. When I added jboss-deployment-structure.xml under WEB-INF, some more exception message were print out. Like,

                         

                        17:10:16,364 INFO  [org.apache.struts2.views.velocity.VelocityManager] (http--127.0.0.1-8080-1) Initializing velocity using D:\jboss-as-7.1.1.Final\standalone\deployments\cynthia.war\WEB-INF\velocity.properties from file system
                        17:10:16,495 INFO  [stdout] (http--127.0.0.1-8080-1) 2012-11-28 17:10:16 DEBUG com.mchange.v2.resourcepool.BasicResourcePool:1644 - trace com.mchange.v2.resourcepool.BasicResourcePool@331fd8 [managed: 3, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@19a274f)

                        17:10:16,508 INFO  [stdout] (http--127.0.0.1-8080-1) Hibernate: select sysmenu0_.menuId as menuId0_, sysmenu0_.description as descript2_0_, sysmenu0_.displayOrder as displayO3_0_, sysmenu0_.icon as icon0_, sysmenu0_.levelNo as levelNo0_, sysmenu0_.menuKey as menuKey0_, sysmenu0_.parentMenuId as parentMe7_0_, sysmenu0_.uri as uri0_ from sys_menu sysmenu0_

                        17:10:16,513 INFO  [stdout] (http--127.0.0.1-8080-1) 2012-11-28 17:10:16 DEBUG com.mchange.v2.c3p0.impl.NewPooledConnection:367 - com.mchange.v2.c3p0.impl.NewPooledConnection@1786986 handling a throwable.

                        17:10:16,515 INFO  [stdout] (http--127.0.0.1-8080-1) com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'ericchen.sys_menu' doesn't exist

                        17:10:16,515 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                        17:10:16,515 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                        17:10:16,515 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                        17:10:16,518 INFO  [stdout] (http--127.0.0.1-8080-1)  at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                        17:10:16,518 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

                        17:10:16,518 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mysql.jdbc.Util.getInstance(Util.java:386)

                        17:10:16,518 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)

                        17:10:16,518 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096)

                        17:10:16,518 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)

                        17:10:16,520 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)

                        17:10:16,520 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)

                        17:10:16,520 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2734)

                        17:10:16,520 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)

                        17:10:16,520 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2322)

                        17:10:16,523 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)

                        17:10:16,523 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                        17:10:16,523 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                        17:10:16,523 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                        17:10:16,523 INFO  [stdout] (http--127.0.0.1-8080-1)  at java.lang.reflect.Method.invoke(Method.java:597)

                        17:10:16,525 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)

                        17:10:16,525 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)

                        17:10:16,525 INFO  [stdout] (http--127.0.0.1-8080-1)  at $Proxy26.executeQuery(Unknown Source)

                        17:10:16,525 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.loader.Loader.getResultSet(Loader.java:1897)

                        17:10:16,525 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1698)

                        17:10:16,525 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.loader.Loader.doQuery(Loader.java:832)

                        17:10:16,528 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:293)

                        17:10:16,528 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.loader.Loader.doList(Loader.java:2382)

                        17:10:16,528 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.loader.Loader.doList(Loader.java:2368)

                        17:10:16,528 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2198)

                        17:10:16,528 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.loader.Loader.list(Loader.java:2193)

                        17:10:16,530 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:470)

                        17:10:16,530 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)

                        17:10:16,530 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195)

                        17:10:16,530 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1248)

                        17:10:16,530 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)

                        17:10:16,530 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:257)

                        17:10:16,533 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.gdis.cynthia.core.dao.orm.DaoBaseSupport.getQueryResult(DaoBaseSupport.java:184)

                        17:10:16,533 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.gdis.cynthia.core.web.dao.CrudDaoImpl.getObjectList(CrudDaoImpl.java:136)

                        17:10:16,533 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.gdis.cynthia.core.web.service.CrudServiceImpl.getEntityList(CrudServiceImpl.java:80)

                        17:10:16,533 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                        17:10:16,533 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                        17:10:16,535 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                        17:10:16,535 INFO  [stdout] (http--127.0.0.1-8080-1)  at java.lang.reflect.Method.invoke(Method.java:597)

                        17:10:16,535 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)

                        17:10:16,535 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

                        17:10:16,535 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at $Proxy23.getEntityList(Unknown Source)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.gdis.cynthia.sysmanage.action.SysMenuManageAction.getListData(SysMenuManageAction.java:59)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at java.lang.reflect.Method.invoke(Method.java:597)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)

                        17:10:16,538 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:236)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:236)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,548 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

                        17:10:16,558 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.gdis.cynthia.core.web.CrudInterceptor.intercept(CrudInterceptor.java:27)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:511)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:147)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

                        17:10:16,568 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.gdis.cynthia.init.web.AuthenticationFilter.doFilterInternal(AuthenticationFilter.java:27)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

                        17:10:16,578 INFO  [stdout] (http--127.0.0.1-8080-1)  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

                        17:10:16,588 INFO  [stdout] (http--127.0.0.1-8080-1)  at java.lang.Thread.run(Thread.java:662)

                        • 9. Re: How can I show my exception in console
                          nuhsoah Newbie

                          The following is my jboss-deployment-structure.xml,

                           

                          <jboss-deployment-structure>
                              <deployment>
                                  <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
                                  <exclusions>
                                      <module name="org.apache.log4j" />
                                      <module name="org.hibernate" />
                                  </exclusions>
                              </deployment>
                          </jboss-deployment-structure>

                           

                          I debug into hbiernate's SqlExceptionHelper class, in its logExceptions method, I found LOG' debug level is still not enabled event I turn it down to debug level in log4j.propeties.

                           

                          public void logExceptions( SQLException sqlException,
                                                         String message ) {
                                  if (LOG.isEnabled(Level.ERROR)) {
                                      if (LOG.isDebugEnabled()) {
                                          message = StringHelper.isNotEmpty(message) ? message : DEFAULT_EXCEPTION_MSG;
                              LOG.debug( message, sqlException );
                                      }
                                      while (sqlException != null) {
                                          StringBuilder buf = new StringBuilder(30).append("SQL Error: ").append(sqlException.getErrorCode()).append(", SQLState: ").append(sqlException.getSQLState());
                                          LOG.warn(buf.toString());
                                          LOG.error(sqlException.getMessage());
                                          sqlException = sqlException.getNextException();
                                      }
                                  }
                              }

                          • 10. Re: How can I show my exception in console
                            nuhsoah Newbie

                            I am using hibernate4.1.6 and it uses jboss-logging-3.1.0 log framework. Is it the devil?

                            • 11. Re: How can I show my exception in console
                              James Perkins Master

                              Are you using JBoss Logging or log4j? You indicated you had a log4j.jar in your deployment. If you want to use a log4j configuration in AS 7.1.1, you need to exclude the server of log4j.

                               

                              That said looking at your log4j configuration your probably better of using the server for your configuration instead. It will allow for runtime updates so you can turn on and off debugging without having to redeploy your application.

                               

                              The CLI commands to duplicate your log4j configuration, minus the stdout one, are:

                              /subsystem=logging/periodic-rotating-file-handler=cynthia:add(suffix=".yyyy-MM-dd",formatter="%d{yyyy-MM-dd HH:mm:ss} %t %5p %c{1}: - %m%n",file={"relative-to"=>"jboss.server.log.dir","path"=>"cynthia.log"})
                              
                              /subsystem=logging/logger=org.hibernate:add(level=DEBUG)
                              
                              /subsystem=logging/logger=org.hibernate.SQL:add(level=DEBUG)
                              
                              /subsystem=logging/logger=org.hibernate.tool.hbm2ddl:add(level=WARN)
                              

                               

                              The XML would look like:

                                      <subsystem xmlns="urn:jboss:domain:logging:1.1">
                                          <console-handler name="CONSOLE">
                                              <level name="INFO"/>
                                              <formatter>
                                                  <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                                              </formatter>
                                          </console-handler>
                                          <periodic-rotating-file-handler name="FILE">
                                              <formatter>
                                                  <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                                              </formatter>
                                              <file relative-to="jboss.server.log.dir" path="server.log"/>
                                              <suffix value=".yyyy-MM-dd"/>
                                              <append value="true"/>
                                          </periodic-rotating-file-handler>
                                          <periodic-rotating-file-handler name="cynthia">
                                              <formatter>
                                                  <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss} %t %5p %c{1}: - %m%n"/>
                                              </formatter>
                                              <file relative-to="jboss.server.log.dir" path="cynthia.log"/>
                                              <suffix value=".yyyy-MM-dd"/>
                                          </periodic-rotating-file-handler>
                                          <logger category="com.arjuna">
                                              <level name="WARN"/>
                                          </logger>
                                          <logger category="org.apache.tomcat.util.modeler">
                                              <level name="WARN"/>
                                          </logger>
                                          <logger category="sun.rmi">
                                              <level name="WARN"/>
                                          </logger>
                                          <logger category="jacorb">
                                              <level name="WARN"/>
                                          </logger>
                                          <logger category="jacorb.config">
                                              <level name="ERROR"/>
                                          </logger>
                                          <logger category="org.hibernate">
                                              <level name="DEBUG"/>
                                          </logger>
                                          <root-logger>
                                              <level name="INFO"/>
                                              <handlers>
                                                  <handler name="CONSOLE"/>
                                                  <handler name="FILE"/>
                                              </handlers>
                                          </root-logger>
                                      </subsystem>
                              

                               

                              The one difference here is by default the root level is set to INFO instead of DEBUG.

                               

                              --

                              James R. Perkins

                              • 12. Re: How can I show my exception in console
                                nuhsoah Newbie

                                Hi James,

                                     I did want to use log4j in my application. But my applicatio uses Hibernate4.1.6 which uses Jboss Logging log framework, and Quartz uses SLFJ log framework. I must make them work well.

                                • 13. Re: How can I show my exception in console
                                  James Perkins Master

                                  Hello Eric,

                                  You can still use log4j in your application, but configure logging via the logging subsystem. If you want to use the logging subsystem to configuration your logging, then you don't want to include a log4j library in your deployment. If you want to use a log4j configuration file, then you will have to include a log4j library in your deployment and exclude the servers version of log4j.

                                   

                                  So in short, the logging subsystem configuration works with pretty much any logging facade you choose to use including log4j.

                                   

                                  --

                                  James R. Perkins

                                  • 14. Re: How can I show my exception in console
                                    nuhsoah Newbie

                                    Hi James,

                                         Thanks for your help. I had deleted log4j.jar from my application library, and change the root-logger's level to INFO, it worked. When I debuged into my struts2 code, I found the logger is type of org.apache.commons.logging.impl.SLF4JLocationAwareLog. I did not had such library in my application. Now I found this library was loaded by jboss in %JBOSS_HOME%\modules\org\slf4j\jcl-over-slf4j\main\jcl-over-slf4j-1.6.1.jar.

                                         I have two questions now.

                                    1. The DEBUG priority level is lower than INFO, why does it not work?

                                    2. JBoss 7.1.1-final loads jboss-logging / hibernate / velocity / ... modules automtically, but my application also has these library, if I need to exclude these library using the jboss-deployment-structure.xml?

                                     

                                    Thanks.

                                    1 2 Previous Next