2 Replies Latest reply on Apr 14, 2011 4:59 PM by 745775

    How to config weblogic 10.3.3 server log and domain log?

    745775
      I need to change the default logging configuration for both server log and the domain log. The server logging configuration (such as limiting the number of retained log files) can be updated in the Admin console. Howerver there are 100 domains running in a weblogic instance, can this be accomplished by updating a configuration file for each domain instead of going through the web interface?
      Also, how can I change the domain log configuration? Is there a configuration file or a command line argument for this?

      Thanks,
      Hong
        • 1. Re: How to config weblogic 10.3.3 server log and domain log?
          Ravish Mody_MiddlewareMagic
          Hi Hong,

          Based on your requirement we have just created a script for you which would full fill your requirement.


          Note: Please the below properties files and the WLST script in the same same location

          "*domain.properties*"
           
          domain.count=2
          
          rotationType=bySize
          numberOfFilesLimited=yes
          fileMinSize=3000
          rotateLogOnStartup=yes
          fileCount=5
          
          ### Domain-1 Details ###
          domain.1.name=Domain_7001
          domain.1.admin.url=t3://10.10.10.10:7001
          domain.1.admin.username=weblogic
          domain.1.admin.password=weblogic
          
          domain.1.server.count=2
          
          domain.1.server.1.name=AdminServer
          domain.1.server.2.name=MS-1
          
          
          ### Domain-2 Details ###
          domain.2.name=Test_Domain
          domain.2.admin.url=t3://20.20.20.20:8001
          domain.2.admin.username=weblogic
          domain.2.admin.password=weblogic
          
          domain.2.server.count=2
          
          domain.2.server.1.name=AdminServer
          domain.2.server.2.name=MS-1
          Below is the WLST script "*domainLogConfigurtionChange.py*" which would use the above properties file.
           
          #############################################################################
          #
          # @author Copyright (c) 2010 - 2011 by Middleware Maigc, All Rights Reserved.
          #
          #############################################################################
          
          from java.io import FileInputStream
          
          propInputStream = FileInputStream("domain.properties")
          configProps = Properties()
          configProps.load(propInputStream)
          
          totalNumbersofDomains=configProps.get("domain.count")
          
          rotationType=configProps.get("rotationType")
          numberOfFilesLimited=configProps.get("numberOfFilesLimited")
          fileMinSize=configProps.get("fileMinSize")
          rotateLogOnStartup=configProps.get("rotateLogOnStartup")
          fileCount=configProps.get("fileCount")
          
          def str2bool(v):
               return v.lower() in ("yes", "true", "t", "1")
          
          domainTmpCount=1
          while (domainTmpCount <= int(totalNumbersofDomains)) :
               
               domainName = configProps.get("domain."+ str(domainTmpCount)+".name")
               domainAdminUrl = configProps.get("domain."+ str(domainTmpCount)+".admin.url")
               domainAdminUserName = configProps.get("domain."+ str(domainTmpCount)+".admin.username")
               domainAdminPassword = configProps.get("domain."+ str(domainTmpCount)+".admin.password")
               serverTmpCount = configProps.get("domain."+ str(domainTmpCount)+".server.count")
          
               connect(domainAdminUserName, domainAdminPassword, domainAdminUrl)
               print '==============================================='
               print 'Changing Log Settings For Domain....', domainName
               print '==============================================='
          
               serverTmpCount=1
               while (serverTmpCount <= int(totalNumbersofDomains)) :
                    edit()
                    startEdit()          
                    serverName = configProps.get("domain."+ str(domainTmpCount)+".server."+ str(serverTmpCount)+".name")
                    print 'Changing Log Setting for serverName: ' , serverName
                    cd('/Servers/' + serverName + '/Log/' + serverName)
                    cmo.setRotationType(rotationType)
                    x = str2bool(numberOfFilesLimited)
                    cmo.setNumberOfFilesLimited(x)
                    cmo.setFileMinSize(int(fileMinSize))
                    cmo.setRotateLogOnStartup(str2bool(rotateLogOnStartup))
                    cmo.setFileCount(int(fileCount))
                    cmo.setFileName('logs/' + serverName + '.log')
                    activate()
                    serverTmpCount = serverTmpCount +1
          
               domainTmpCount = domainTmpCount +1
          For more information on how these WLST scripts can be used please refer to the following link

          Topic: WLST
          http://middlewaremagic.com/weblogic/?page_id=1492


          Regards,
          Ravish Mody