Hi,
Based on the Comment/Query of one of our Magic Subscriber “Kimjim” (http://middlewaremagic.com/weblogic/?p=1473#comment-4594) , We are going to see how we can edit the WebServer Logging like displaying the Client IP Adddress in the access Log of a Server by adding (Extended Loging Formats c-ip) and changing the various attribute of Logging in one go.
This script also demonstrates how we should use the edit() , activate() and startEdit() kind of functions inside the WLST Script if we are migrating our WLST Scripts from WebLogic 8.1 because in WebLogic 8.1 the change control (Lock & Edit) feature was not available in the Admin Console.
Step1). Write the following WLST Script somewhere in your file system:
“changeLogFormats.py”
connect('weblogic','weblogic1','t3://localhost:7001') domainConfig() managedServers=cmo.getServers() print 'Found ' + `len(managedServers)` + ' managed servers' for managedServer in managedServers: try: edit() startEdit() serverName = managedServer.getName() print 'tt==================='+serverName+'====================' cd('/Servers/'+serverName+'/WebServer/'+serverName+'/WebServerLog/'+serverName) cmo.setLogTimeInGMT(false) cmo.setLogFileFormat('common') cmo.setELFFields('c-ip date time time-taken bytes cs-method cs-uri sc-status') activate() print ' ' print ' ' except java.lang.Exception, ex: print 'Exception on Changing the Log Attributes: ' + ex.toString()
Step2). Now we need to set the CLASSPATH and PATH environment variables using setWLSEnv.sh or setDomainEnv.sh script.
Step3). Run the WLST Script java WebLogic.WLST changeLogFormats.py
java weblogic.WLST changeLogFormats.py Initializing WebLogic Scripting Tool (WLST) ... Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands Connecting to t3://localhost:7001 with userid weblogic ... Successfully connected to Admin Server 'AdminServer' that belongs to domain 'base_domain'. Warning: An insecure protocol was used to connect to the server. To ensure on-the-wire security, the SSL port or Admin port should be used instead. Location changed to serverRuntime tree. This is a read-only tree with DomainMBean as the root. For more help, use help(domainConfig) Found 2 managed servers Location changed to edit tree. This is a writable tree with DomainMBean as the root. To make changes you will need to start an edit session via startEdit(). For more help, use help(edit) Starting an edit session ... Started edit session, please be sure to save and activate your changes once you are done. ===================AdminServer==================== Activating all your changes, this may take a while ... The edit lock associated with this edit session is released once the activation is completed. Activation completed Already in Edit Tree Starting an edit session ... Started edit session, please be sure to save and activate your changes once you are done. ===================MS1==================== Activating all your changes, this may take a while ... The edit lock associated with this edit session is released once the activation is completed. Activation completed
.
.
Thanks
Jay SenSharma
August 1st, 2011 on 8:11 pm
Hey Jay
Thanks Man this an awesome script .
This saved me a lot of time and thank you for all your help.
Thank You very much once again.
August 1st, 2011 on 11:19 pm
First of all thanks for this blog.I found here since i am working with oracle products a lot of answers to my questions.
Now I have some real prod. issues with some webservice clients ,for which i have solutions by migrating to apache cxf but i want to know if you are aware of such problems i described here ?
http://forums.oracle.com/forums/thread.jspa?threadID=2261737&tstart=0
If you have time….
Cheers
Cristian
August 1st, 2011 on 11:55 pm
Hi Cristian,
I am not sure but i am suspecting that the problem is because your have created “created a pool of ports (webservice clients)”
So can you test it without creating Pool of clients …Means by just creating Clients on the Fly to see it makes any improvement on the request and response objects. Because while pooling the Clients if we make a Service Port inside the client then definitely the request & response objects will be tied up with that client for some time.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
August 2nd, 2011 on 12:03 am
Did not expected and answer so fast.Thank you for this.
That pool is simply a list with ports instantiated in advance and reused for calling the webservice.
Unfortunatelly while profiling i noticed that the ports have references to request and responses and because the payload of SOAP messages are quite big for a pool of 250 ports the amount of memory is quite big.With CXF clints the pool size has a very small footprint.
However i ended up doing this because before i created a client on each request. Apparently this works when there is no load (10.3.0 weblogic) but all webservices client instantiations of paralel requests end up using same synchronized code …and i guess there is a semaphore that creates the system to be very slow…
The problem is described here…
http://forums.oracle.com/forums/thread.jspa?threadID=2256583&tstart=75
August 3rd, 2011 on 9:34 am
Hi Cristian,
The Apache CXF services has the default Connection Mode as “Keep Alive” You can try specifying it to “Close” so that the request & response objects associated with it will be released immediately:
In the following link you will see how we can set the Client side conduit element for CXF clients. http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html
Connection Specifies whether a particular connection is to be kept open or closed after each request/response dialog. There are two valid values:
1). Keep-Alive(default) specifies that the client wants to keep its connection open after the initial request/response sequence. If the server honors it, the connection is kept open until the consumer closes it.
2).close specifies that the connection to the server is closed after each request/response sequence.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
November 8th, 2016 on 9:24 pm
Hi Middelware Magic,
Do you have a script that updates the server start Classpath and Arguments of a particular managed server?
Regards,
James Peter
November 8th, 2016 on 9:48 pm
Hello James,
Hope the following article might be helpful for you, which talks about “Alternative Of Setting CLASSPATH” for individual servers.
http://middlewaremagic.com/weblogic/?p=780
It is also possible to change the “Server Start” tabs settings using WLST kind of utilities as well as from Admin Console.
Regards
Jay SenSharma