1 2 Previous Next 18 Replies Latest reply on May 4, 2015 6:12 AM by sreekanth.munarai

    Logging Issue

    sreekanth.munarai

      Hi All,

       

      Been trying to change logging directory from inside Standalone folder to out of the JBoss directory.

      I have changed the path in standalone.xml file for the server.log to the new path.

      But encountering with below issue:

      java.lang.reflect.InvocationTargetException

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

              at java.lang.reflect.Method.invoke(Method.java:597)

              at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.applyPostCreate(AbstractPropertyConfiguration.java:219)

              at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.applyPostCreate(AbstractPropertyConfiguration.java:199)

              at org.jboss.logmanager.config.LogContextConfigurationImpl.doApplyPostCreate(LogContextConfigurationImpl.java:315)

              at org.jboss.logmanager.config.LogContextConfigurationImpl.doPrepare(LogContextConfigurationImpl.java:347)

              at org.jboss.logmanager.config.LogContextConfigurationImpl.prepare(LogContextConfigurationImpl.java:291)

              at org.jboss.logmanager.config.LogContextConfigurationImpl.commit(LogContextConfigurationImpl.java:300)

              at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:542)

              at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:97)

              at org.jboss.as.logging.logmanager.ConfigurationPersistence.configure(ConfigurationPersistence.java:148)

              at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:300)

              at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:262)

              at java.util.logging.LogManager$2.run(LogManager.java:267)

              at java.security.AccessController.doPrivileged(Native Method)

              at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:265)

              at java.util.logging.LogManager.getLogManager(LogManager.java:248)

              at java.util.logging.Logger.<init>(Logger.java:225)

              at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1092)

              at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1089)

              at java.util.logging.LogManager$1.run(LogManager.java:180)

              at java.security.AccessController.doPrivileged(Native Method)

              at java.util.logging.LogManager.<clinit>(LogManager.java:157)

              at org.jboss.modules.Main.main(Main.java:438)

      Caused by: java.io.FileNotFoundException: E:\EAP6.2\jboss-eap-6.2\standalone\log\E:\EAP6.2\Logs\Online\homeport\system\hibernate.log (The filename, directory name, o

      r volume label syntax is incorrect)

              at java.io.FileOutputStream.openAppend(Native Method)

              at java.io.FileOutputStream.<init>(FileOutputStream.java:192)

              at org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:154)

              at org.jboss.logmanager.handlers.SizeRotatingFileHandler.setFile(SizeRotatingFileHandler.java:141)

              at org.jboss.logmanager.handlers.FileHandler.setFileName(FileHandler.java:192)

              ... 26 more

       

      Seems it trying to load path twice but I'm unable to find where i can make required changes.

       

      Please share your advises.Thanks.

        • 1. Re: Logging Issue
          abhumbe

          hi,

          1. Define <path> setting which point to the custom directory location:

          <paths>
            <path name="example.log.dir" path="/mnt/example/log/jboss"/>
          </paths>

           

          2. Modify the relative-to attribute of <file> for server.log and change "jboss.server.log.dir" to the above path name "example.log.dir"

          <subsystem xmlns="urn:jboss:domain:logging:1.2">
            ...(snip)...
            <periodic-rotating-file-handler name="FILE" autoflush="true">
            <formatter>
            <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
            </formatter>
            <file relative-to="example.log.dir" path="server.log"/>
            <suffix value=".yyyy-MM-dd"/>
            <append value="true"/>
            </periodic-rotating-file-handler>
            ...(snip)...
          </subsystem>

           

          3.We can use following option as well to change log file location

          $JBOSS_HOME/bin/standalone.sh -Djboss.server.log.dir=/Valid/path

           

          Hope it helps..

          • 2. Re: Logging Issue
            sreekanth.munarai

            Hi Abhijit,

             

            Thanks for the update. I tried to follow your steps but unable to resolve the issue the issue.

            Find the below details of my environment:

             

            JBoss directory: E:\EAPFINAL\jboss-eap-6.3\

            I need logs to be out of the Jboss directory, created below folder outside the Jboss:

            Logs dir: E:\EAPFINAL\Logs\Online  (Logs should be created under this folder as E:\EAPFINAL\Logs\Online \server.log)

            This is my requirement.

            Please share your advises\inputs.

             

            Thanks,

            Sreekanth

            • 3. Re: Logging Issue
              abhijithumbe

              Hi Sreekanth,

              did you see same exception after  ? Can you share standalone.xml with us ? I tried with same steps and its working fine for me.

              • 4. Re: Logging Issue
                jamezp

                You can either define a new path and change the log handlers to use your new path or override the jboss.server.log.dir property. You can override the property by passing -Djboss.server.log.dir=E:\EAPFINAL\Logs\Online as a command line parameter or adding the property to the JAVA_OPTS environment variable in the $JBOSS_HOME/bin/standalone.conf or standalone.conf.bat.

                 

                --

                James R. Perkins

                1 of 1 people found this helpful
                • 5. Re: Logging Issue
                  sreekanth.munarai

                  Thanks Abhijit/James, Logs path directory has been changed after adding in -Djboss.server.log.dir=E:\EAP6.2\Logs\Online in JAVA_OPTS.

                  Now logs are generated in desired path. But Prob is, same exceptions still encounters as follows:

                   

                  1. java.lang.reflect.InvocationTargetException

                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                          at java.lang.reflect.Method.invoke(Method.java:597)

                          at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.applyPostCreate(AbstractPropertyConfiguration.java:219)

                          at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.applyPostCreate(AbstractPropertyConfiguration.java:199)

                          at org.jboss.logmanager.config.LogContextConfigurationImpl.doApplyPostCreate(LogContextConfigurationImpl.java:315)

                          at org.jboss.logmanager.config.LogContextConfigurationImpl.doPrepare(LogContextConfigurationImpl.java:347)

                          at org.jboss.logmanager.config.LogContextConfigurationImpl.prepare(LogContextConfigurationImpl.java:291)

                          at org.jboss.logmanager.config.LogContextConfigurationImpl.commit(LogContextConfigurationImpl.java:300)

                          at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:542)

                          at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:97)

                          at org.jboss.as.logging.logmanager.ConfigurationPersistence.configure(ConfigurationPersistence.java:148)

                          at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:300)

                          at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:262)

                          at java.util.logging.LogManager$2.run(LogManager.java:267)

                          at java.security.AccessController.doPrivileged(Native Method)

                          at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:265)

                          at java.util.logging.LogManager.getLogManager(LogManager.java:248)

                          at java.util.logging.Logger.<init>(Logger.java:225)

                          at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1092)

                          at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1089)

                          at java.util.logging.LogManager$1.run(LogManager.java:180)

                          at java.security.AccessController.doPrivileged(Native Method)

                          at java.util.logging.LogManager.<clinit>(LogManager.java:157)

                          at org.jboss.modules.Main.main(Main.java:438)

                  Caused by: java.io.FileNotFoundException: E:\EAP6.2\Logs\Online\E:\EAP6.2\Logs\Online\homeport\system\hibernate.log (The filename, directory name, or volume label sy

                  ntax is incorrect)

                          at java.io.FileOutputStream.openAppend(Native Method)

                          at java.io.FileOutputStream.<init>(FileOutputStream.java:192)

                          at org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:154)

                          at org.jboss.logmanager.handlers.SizeRotatingFileHandler.setFile(SizeRotatingFileHandler.java:141)

                          at org.jboss.logmanager.handlers.FileHandler.setFileName(FileHandler.java:192)

                   

                  It seems above highlighted error trying to load the path twice.

                  I have one more logger "Hibernate". I have separate directory where the hibernate logs to be created.Path is E:\EAP6.2\Logs\Online\homeport\system\hibernate.log

                   

                  Changes made in standalone.xml file for Hibernate logging:


                       <size-rotating-file-handler name="HIBERNATE" autoflush="true">

                                       <level name="TRACE"/>

                                       <formatter>

                                           <pattern-formatter pattern="%d{dd MMM yyy HH:mm:ss} %-5p %m%n"/>

                                       </formatter>

                                       <file relative-to="jboss.server.log.dir" path="E:\EAP6.2\Logs\Online\homeport\system\hibernate.log"/>

                                       <rotate-size value="20480k"/>

                                       <max-backup-index value="10"/>

                                      <append value="true"/>

                                   </size-rotating-file-handler>


                  Please advise how to move further to solve this.


                  Thanks,

                  Sreekanth

                  • 6. Re: Logging Issue
                    abhijithumbe

                    Hi,

                    Looks like you are facing this issue because you have specified log file location in 'path' attribute as well. To resolve this issue specify log file name for 'path' attribute.

                    To change log file location create custom property or overwrite value of  "-Djboss.server.log.dir" while starting server instance.

                    ~~~

                      <size-rotating-file-handler name="HIBERNATE" autoflush="true">

                      .. .

                           <file relative-to="jboss.server.log.dir" path="hibernate.log"/>   <!--Notice this line-->
                    </size-rotating-file-handler>

                    ~~~

                    • 7. Re: Logging Issue
                      jamezp

                      As Abhijit said you're giving it both a relative and absolute path. You need to do one or the other. Either define a the relative-to or define the path as absolute. I've added a JIRA to validate the path attribute.

                       

                      --

                      James R. Perkins

                      • 8. Re: Logging Issue
                        sreekanth.munarai

                        Hi James/Abhijit,

                         

                        I have made required changes as below in my standalone.xml file

                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                        <size-rotating-file-handler name="HIBERNATE" autoflush="true">

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

                        </size-rotating-file-handler>

                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                        Exception been resolved and logs been redirected to different custom directory.

                        But the prob is,hibernate logs are generating in the directory of server logs where in real i want those logs in sub directory of those logs.

                        server logs are generated in the path: E:/EAP6.2/Logs/Online/

                        hibernate logs are getting generated in same path: E:/EAP6.2/Logs/Online/ where as I need hibernate logs in below path: E:/EAP6.2/Logs/Online/homeport/System/

                         

                        Please advise.Thanks

                        • 9. Re: Logging Issue
                          jamezp

                          You could just make the path homeport/System/hibernate.log. The path can be any relative path.

                           

                          --

                          James R. Perkins

                          • 10. Re: Logging Issue
                            sreekanth.munarai

                            Hi James,

                            Sorry for the delay in reply.The current configuration in my standalone.xml file is as below:

                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                            the above configuration runs without error/exceptions but creates hibernate.logs under "E:/EAP6.2/Logs/Online/" whereas i need the logs to be generated in "E:/EAP6.2/Logs/Online/homeport/System/"

                             

                            And when i change the configuration as below:

                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                            <file relative-to="jboss.server.log.dir" path="E:/EAP6.2/Logs/Online/homeport/System/hibernate.log"/>

                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                             

                            It generates the logs in needed directory but starts up with errors/exceptions mentioned earlier.

                             

                            Is there something need to be changed in logging.properties file?

                             

                            Thanks,

                            Sreekanth

                            • 11. Re: Logging Issue
                              abhijithumbe

                              Hi,

                              It should be like as:

                              ~~~

                              <file path="E:/EAP6.2/Logs/Online/homeport/System/hibernate.log"/>

                              ~~~

                              Try with this and let us know if you face any issue.

                              • 12. Re: Logging Issue
                                sreekanth.munarai

                                Hi Abhijit,

                                 

                                Thanks a ton!!!!! Its all working fine as needed!!

                                 

                                Except that logging i have observed GC logs are not getting generated! Could you please advise, I'm missing something.

                                • 13. Re: Logging Issue
                                  abhijithumbe

                                  Hi,

                                   

                                  Good to know it working as expected...!!

                                   

                                  To configure GC log you have to add following options into standalone.conf file

                                  ~~~

                                  -verbose:gc -Xloggc:gc.log.`date +%Y%m%d%H%M%S` -XX:+PrintGCDetails -XX:+PrintGCDateStamps

                                  ~~~

                                   

                                  For domain mode add these options in host.xml

                                  ~~~~

                                    <server name="Server1" group="other-server-group" auto-start="true">

                                    <jvm name="default">

                                    <jvm-options>

                                    <option value="-Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=n"/>

                                    <option value="-Xloggc:/home/userone/jboss-eap-6.0GA/domain/log/Server1GC.log"/>

                                    <option value="-XX:+PrintGCDetails"/>

                                    <option value="-XX:+PrintGCDateStamps"/>

                                    </jvm-options>

                                    </jvm>

                                    <socket-bindings socket-binding-group="full-ha-sockets" port-offset="100"/>

                                    </server>

                                  ~~~~

                                  • 14. Re: Logging Issue
                                    jamezp

                                    If the jboss.server.log.dir is set to "E:/EAP6.2/Logs/Online" you can still use the relative to with a relative path.

                                     

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

                                     

                                     

                                    What you don't want to do is use an absolute path AND a relative-to attribute.

                                     

                                    --

                                    James R. Perkins

                                    1 2 Previous Next