4 Replies Latest reply: Nov 17, 2008 11:21 AM by david.karr RSS

    Problem with wlst. Print messages in a particular file.

    jm*425680*go
      Hello.

      I have a problem with a script of wlst. I like get values and print in a file.
      Example... heapSizeCurrent. I get values but I don't know send to file own (example.log).

      Can someone help me, please?

      Script:

      uname = "weblogic"
      pwd = "weblogic"
      url = "t3://localhost:7001"

      def monitorJVMHeapSize():

           connect(uname, pwd, url)
           serverNames = getRunningServerNames()

           for name in serverNames:
                print 'Now checking '+name.getName()
                try:
                     cd("/ServerRuntimes/"+name.getName()+"/JVMRuntime/"+name.getName())
                     print 'OK Servidor '+name.getName()
                     heapSize = cmo.getHeapSizeCurrent()
                     heapFree = cmo.getHeapFreeCurrent()
                     heapFreePercent = cmo.getHeapFreePercent()
                     print "heapSize: "+str(heapSize)
                     print "heapFree: "+str(heapFree)
                     print "heapFreePercent: "+str(heapFreePercent)
                except WLSTException,e:
                     # this typically means the server is not active, just ignore
                     pass
                     print 'Problemas con el servidor '+name.getName()
           stopRedirect()
           disconnect()

      def getRunningServerNames():
           domainConfig()
           return cmo.getServers()

      monitorJVMHeapSize()