March 12, 2013

Enable logging in Weblogic to print System.out.println()



I have a web application in which I have given “System.out.println()” statements to print information, but I could not see these statements in weblogic logs. To get these print statements in weblogic logs, “stdout” should be enabled in the weblogic server log. To check this, we can follow the below procedure.

  • Go to weblogic and select the server (Ex: AdminServer) in which you want to enable this logging
  • Go to “Logging” tab of the server
  • Click on “Advanced” option
  • Enable or Check in the option “Redirect stdout logging enabledif it is not checked in
  • And also Check in the option “Redirect stderr logging enabledto print error statements in the server logs
  • After enabling these options, the screen would look as below  



  • Click on Save button and Restart the server instance
 

5 comments:

  1. Thank for your post. What if there is more than one application that deployed on one server and each on of them has its own log. I do not want mix all applications logs in one place. How to separate them so the log of each application is stored in separate file in sever.

    ReplyDelete
    Replies
    1. Hi Ahmad,
      Sorry for the late reply.
      You can use the logging tools like log4j to have your own log files.

      Delete
  2. Hi Anand,

    The above configuration works only if you start the server using node manager. What if the server is started using command prompt?

    Regards,

    ReplyDelete
    Replies
    1. Hi,
      It should work even if you run the server from command prompt. Open console and do the above steps. Then restart the server in command prompt. Node manager is not mandatory for this.

      Delete
  3. I have a deployment that uses log4j. It logs well to a separate log file when I deploy on 11g and on 12c development instance. But when I deploy on a different 12c weblogic prod server , no log file is generated.

    ReplyDelete