5 Replies Latest reply on Aug 24, 2011 8:05 PM by M Mudu

    Logging configurations

    M Mudu Newbie



      I am trying to create a solr-.yyyy-MM-dd.log file in the /standalone/log directory.


      From the SOLR wiki I have to add:


      <logger category="org.apache.solr">

                                 <level name="INFO"/>



      in the standalone.xml.


      Do I need to create a new logger?


      In the standalone.xml the <root-logger> is defined:



                      <level name="INFO"/>


                          <handler name="CONSOLE"/>

                          <handler name="FILE"/>





      How do I create a new logger that logs output to the solr-.yyyy-MM-dd.log file?


      Should I do this below?



                      <level name="INFO"/>


                           <handler name="SOLRFILE"/>





      Can anyone please help me with this issue?





        • 1. Re: Logging configurations
          Prasad Deshpande Expert

          You need to create a handler first somethig like this


                  <periodic-rotating-file-handler name="SOLRFILE" autoflush="true">
                      <level name="DEBUG"/>
                          <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                      <file relative-to="jboss.server.log.dir" path="solr.log"/>
                      <suffix value=".yyyy-MM-dd"/>
                      <append value="true"/>


          and a logger like


                  <logger category="org.apache.solr">
                      <level name="INFO"/>
                          <handler name="SOLRFILE"/>


          This will create file solr.log in the log directory. Also, it as the date changes, it will add suffix yyyy-MM-dd to the file. So file solr.log will always be for current date.

          • 2. Re: Logging configurations
            M Mudu Newbie

            Thanks Prasad,


            I have created the handler and logger as you said but I still do not get a solr.log file.


            In the server.log I get the following warnings:


            01:06:27,313 ERROR [stderr] (MSC service thread 1-1) log4j:WARN No appenders could be found for logger (org.apache.solr.core.SolrResourceLoader).

            01:06:27,313 ERROR [stderr] (MSC service thread 1-1) log4j:WARN Please initialize the log4j system properly.

            01:06:27,314 ERROR [stderr] (MSC service thread 1-1) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.


            The jars I have in the WEB-INF/lib used for logging are:







            I am not quite sure what I am missing.


            Any suggestions?

            • 3. Re: Logging configurations
              jaikiran pai Master

              So you are using log4j and not JBoss logging. You will have to create a log4j.xml file with the solr appenders/loggers in that file and package the log4j.xml in your application (.war/WEB-INF/classes folder)

              • 4. Re: Logging configurations
                Prasad Deshpande Expert

                As Jaikiran suggested, also have a look at this thread. http://community.jboss.org/thread/171288?tstart=0

                • 5. Re: Logging configurations
                  M Mudu Newbie

                  I have added a log4j.properties in the solr.war/WEB-INF/classes directory and I got a solr.log.


                  The log4j.properties looks like this:


                  log4j.rootLogger=INFO, SOLR





                  log4j.appender.SOLR.layout.conversionPattern=%d %p [%c{3}] - [%t] - %X{ip}: %m%n


                  Thanks everyone.