Announcement Announcement Module
Collapse
No announcement yet.
stop spring logging for console? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • stop spring logging for console?

    hi..


    i'm a newbie for spring, is i'm trying it out with a simple bean injection with i can barely see my console output from all the logging spring puts out, is there a way i stop it temporely (or at least aim to a file?)

  • #2
    You need to configure your logging system properly.

    Let me explain. Spring uses Commons Logging, like most open source and many commercial products. Commons Logging is an adapter API that sits on top of other logging frameworks. Put log4j on your classpath and configure an appropriate log4j.properties file. See the Spring sample apps as an example. This way you can see as little or as much Spring logging as you want, and send it to any file you want.

    Comment


    • #3
      well i added log4j

      but now i get
      og4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).
      log4j:WARN Please initialize the log4j system properly.

      even after adding a log4j.properties file.

      Comment


      • #4
        Log4J isn't configured properly

        This means your log4j configuration either isn't correct or isn't on the classpath. Either way, it's not a Spring issue, so you're best off seeking help in more appropriate places, e.g. the Log4J web site (http://logging.apache.org/log4j/docs), or Google for one of the many Log4J tutorials.

        HTH,

        Comment


        • #5
          considering the fact that i'm using eclipse

          and that i tried placing the log files into eclipse root, the library where log4j sits, and in workspace, i'm running out of options

          Comment


          • #6
            If you place log4j.properties in the root of a source folder, eclipse will be happy. In that case the file will be automatically copied to the "bin" folder and therefore will be picked up from the classpath.

            Regards,
            Andreas

            Comment


            • #7
              well it was copied from the source to bin

              but i stilll got the warning messages.

              isn't there a system property i should add in eclispe run config?

              btw this is what the properties have:
              log4j.rootLogger=INFO, stdout, logfile

              log4j.appender.stdout=org.apache.log4j.ConsoleAppe nder
              log4j.appender.stdout.layout=org.apache.log4j.Patt ernLayout
              log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n

              Comment


              • #8
                Try this...

                In the Eclipse "Run" dialog, do this:
                1. Choose the "Classpath" tab
                2. Select "User Entries" in the displayed tree
                3. Click the "Advanced..." button
                4. Select "Add Folders" and click OK
                5. Select the folder containing log4j.properties (or log4j.xml) and click OK
                6. Click "Run"
                This folder will stay on your classpath next time you run that item, so you only need to do those steps once per test case (or whatever it is you're running).

                HTH,

                Comment


                • #9
                  thanks that did the trick...

                  i've re-routed everything to a log file so my output won't get garbled...

                  Comment

                  Working...
                  X