1 2 Previous Next 18 Replies Latest reply on Mar 27, 2009 9:24 AM by valatharv

    Log message to screen - possible in Weblogic, is it possible

    valatharv

      Not sure if this is the right place.

      We have a java application what we need is :
      Log messages from the application should print to screen/browser, so that administrator should see all lines printed to console by the program

      This is possible in Weblogic, is it possible to configure in Jboss consider we will be knowing the path of the log file.

      Please suggest.

        • 1. Re: Log message to screen - possible in Weblogic, is it poss
          jaikiran

           

          "valatharv" wrote:


          We have a java application what we need is :
          Log messages from the application should print to screen/browser, so that administrator should see all lines printed to console by the program



          By default log messages (at INFO level) logged through log4j go to the console. You will have to provide us more details as to where exactly you want to see those logs (in the console or browser)? And how are those messages logged? And which version of JBoss and Java?

          • 2. Re: Log message to screen - possible in Weblogic, is it poss
            peterj

            The log4j config file is located at server/xxx/conf/jboss-log4j.xml.

            • 3. Re: Log message to screen - possible in Weblogic, is it poss
              valatharv

              Thanks for the reply.

              We are generating application logs correctly using log jboss-log4j.xml

              Log file is generated under
              "C:\jboss-4.2.3\server\default\log\.log"

              Sample jboss-log4j content from dev machine.

              <appender name="aTPPiclMetaDataSeam_FILE" class="org.jboss.logging.appender.RollingFileAppender">
               <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
               <param name="Threshold" value="DEBUG"/>
               <param name="File" value="${jboss.server.log.dir}/<appSepcific>.log"/>
               <param name="Append" value="true"/>
               <param name="MaxFileSize" value="10240KB"/>
               <param name="MaxBackupIndex" value="2"/>
               <layout class="org.apache.log4j.PatternLayout">
               <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
               </layout>
               </appender>


              What we need is Admin should be able to see .log on BROWSER using some url.

              I have seen this done by Weblogic serv admins., they provided us the url and we were able to see any log generation on Browser.

              May be it is very simple but I need to investigate more.

              • 4. Re: Log message to screen - possible in Weblogic, is it poss
                peterj
                • 5. Re: Log message to screen - possible in Weblogic, is it poss
                  valatharv

                  Thanks a lot Peter, looks good.

                  I will investigate it and try to implement.

                  • 6. Re: Log message to screen - possible in Weblogic, is it poss
                    valatharv

                    Hi,

                    As per previous post I need to provide an interface and display the content of server.log/ application.log on Browser.

                    We are using jboss-4.2.3. I am trying to follow the post as suggested but need help, I think there is no profile.xml for 4.2.3 version.

                    http://www.jboss.org/index.html?module=bb&op=viewtopic&t=152200

                    Summary:
                    a) Server and application logs are generated under "jboss-4.2.3\server\default\log"

                    As per last post in above link
                    b)

                    I used the existing log directory and created a new log.war directory in it.

                    Does it mean that I should create log.war directory under "jboss-4.2.3\server\default\log"

                    c)
                    Then I added the log directory to the applicationURIs and put web.xml and jboss-web.xml into log.war/WEB-INF.

                    Not able to find where to add applicationURIs.

                    Please help to get started.

                    Regards
                    Val

                    • 7. Re: Log message to screen - possible in Weblogic, is it poss
                      peterj

                      b) No, those are part of the instructions if you are using AS 5.0.x. For 4.2.3, follow the steps outlines by the first posting in http://www.jboss.org/index.html?module=bb&op=viewtopic&t=152200

                      c) That is because it is 5.0.x-specific.

                      • 8. Re: Log message to screen - possible in Weblogic, is it poss
                        valatharv

                        Thanks a lot for replying...

                        I know I am doing some basic wrong... :(

                        I added the following to

                        jboss-4.2.3\server\default\deploy\jboss-web.deployer\server.xml

                        <Service name="jboss.web">
                        ......
                         <Context path="/logfiles" docBase="log" debug="0" reloadable="true" />
                        .....
                        


                        Restarted Jboss, but how can I access server.log using URL... ?


                        • 9. Re: Log message to screen - possible in Weblogic, is it poss
                          peterj

                          The URL should be http://loclahost:8080/log/server.log

                          But that will work only if you changed the JBoss AS logs to go into the /logfiles directory. If not, you need to change the path setting to the full path to the log directory.

                          • 10. Re: Log message to screen - possible in Weblogic, is it poss
                            valatharv

                            I performed these steps but no success, please suggest what I am doing wrong :

                            a) jboss-4.2.3\server\default\conf\jboss-log4j.xml
                            server.log is getting created under "jboss-4.2.3\server\default\logfiles"

                            <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
                             <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                             <param name="Threshold" value="INFO"/>
                            
                            <param name="File" value="${jboss.server.home.dir}/logfiles/server.log"/>
                            
                             <echo message="${jboss.server.log.dir}" />
                             <param name="Append" value="false"/>
                             <param name="DatePattern" value="'.'yyyy-MM-dd"/>
                             <layout class="org.apache.log4j.PatternLayout">
                             <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
                             </layout>
                            </appender>


                            b) jboss-4.2.3\server\default\deploy\jboss-web.deployer\server.xml
                            <Connector port="80" address="${jboss.bind.address}"
                             maxThreads="250" maxHttpHeaderSize="8192"
                             emptySessionPath="true" protocol="HTTP/1.1"
                             enableLookups="false" redirectPort="8443" acceptCount="100"
                             connectionTimeout="20000" disableUploadTimeout="true" />
                            
                            <Context path="/logfiles" docBase="log" debug="0" reloadable="true" />...........


                            c) Tried URL
                            http://localhost/log/server.log



                            • 11. Re: Log message to screen - possible in Weblogic, is it poss
                              peterj

                              As I said, the path value must be the full path to the log file directory, specifying "/logfiles" assumes that the directory is at root of the file system. What you really need is:

                              path="/full/path/to/jboss-4.2.3/server/default/logfiles"

                              • 12. Re: Log message to screen - possible in Weblogic, is it poss
                                valatharv

                                Here is the summary, I tried changing the context path (I am trying on windows environment)... but no success

                                I think I am doing something wrong with context path, please guide.

                                a) jboss-log4j.xml

                                <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
                                 <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
                                 <param name="Threshold" value="INFO"/>
                                 <param name="File" value="${jboss.server.home.dir}/logfiles/server.log"/>


                                This genereates server.log file under "C:\jboss-4.2.3\server\default\logfiles"

                                b) Added context path to server.xml (for testing provided the full path)
                                C:\jboss-4.2.3\server\default\deploy\jboss-web.deployer\server.xml

                                <Connector port="80" address="${jboss.bind.address}"
                                <Context path="C:\\jboss-4.2.3\\server\\default\\logfiles" docBase="log" debug="0" reloadable="true" />

                                ....

                                Tried URL :
                                http://localhost/log/server.log





                                • 13. Re: Log message to screen - possible in Weblogic, is it poss
                                  peterj

                                  Swap the "path" and "docBase" settings. The "path" is the URL context name, and docBase is the location of the files on your system. (It helps to read the documentation...)

                                  Then, move the "Context" tag inside the "Host" tag.

                                  ...
                                  <Host ...>
                                   <Context docBase="C:\\jboss-4.2.3\\server\\default\\logfiles" path="/log" reloadable="true" />
                                  </Host>
                                  ...


                                  • 14. Re: Log message to screen - possible in Weblogic, is it poss
                                    valatharv

                                    Great, thanks a lot Peter now I can see the logs on browser.

                                    Just a small help, I can see the logs but it is not formatted very difficult to read as compared to when we open server.log in some editor.

                                    Is there any parameter or settings I should go for.

                                    1 2 Previous Next