Thursday, November 04, 2010

Change diagnostic logging

Apart of the default logging facilities in WebLogic, the Oracle products such as SOA Suite, WebCenter  are also using the custom diagnostics loggers. The normal logfiles are configured during the domain configuration by using WLST via edit/activate sessions.



The diagniostics log files that are shown Enterprise can be changed directly via EM or via WLST. By default these files are created in the log directory of the server. To change these values via WLST can be done as follows:
#
#
# Script to set ODL logging
#
# Start this script with the wlst.sh script from oracle_common
#
# $FMW_HOME/oracle_common/bin/wlst.sh -i changeodllogging.py
#

import os
import sys

username = 'weblogic'
password = ''
adminurl = 't3://node1.vijfhuizen.com:7001'

#Domain settings
domain_name=''

domain_dir='/data/user_projects/domains/' + domain_name

# Connectionsettings
def connectToServer():
  connect(username, password, adminurl)

#Definition to disconnect from a server
def disconnectFromServer():
  disconnect()
  exit()

# change the odl-handler log path
def changeODLPath():
  domainConfig()
  managedServers=cmo.getServers()

  res = ''
  for managedServer in managedServers:
    sname=managedServer.getName()
    path = '/Servers/' + sname
    cd(path)

    lh = listLogHandlers()
    for l in lh:
      lname = l.get('name')
      odlfile = '/data/logs/' + domain_name + '/' + sname + '-' + lname + '-diagnostic.log'
      configureLogHandler(target=sname,name=lname, path=odlfile)
      res = res + '\n' + odlfile

#Calling connectToServer definition with no arguments
connectToServer()

# do the change om all servers ( Admin, managed)
changeODLPath()

#Calling disconnectFromServer definition with no arguments
disconnectFromServer()

Post a Comment