Wednesday, March 21, 2012

How To Log access.log in Weblogic Without Delay

We use Weblogic 10.3.2 here. By default, the access.log will not be updated immediately when a new http request is sent from the client. And currently there is no place in weblogic console where you can change this behavior. The way to work around this is to modify the config.xml file. The following needs to be inserted in between the <server> and </server> tag:
<web-server>
        <web-server-log>
          <buffer-size-kb>0</buffer-size-kb>
        </web-server-log>
    </web-server>

However, it has to be inserted at the correct location. Otherwise it will make config.xml invalid. The following is an example of the correct location:
<server>
    <name>AdminServer</name>
    <ssl>
      <enabled>true</enabled>
      <hostname-verifier xsi:nil="true"></hostname-verifier>
      <hostname-verification-ignored>false</hostname-verification-ignored>
      <export-key-lifespan>500</export-key-lifespan>
      <client-certificate-enforced>true</client-certificate-enforced>
      <listen-port>7022</listen-port>
      <two-way-ssl-enabled>true</two-way-ssl-enabled>
      <ssl-rejection-logging-enabled>true</ssl-rejection-logging-enabled>
      <inbound-certificate-validation>BuiltinSSLValidationOnly</inbound-certificate-validation>
      <outbound-certificate-validation>BuiltinSSLValidationOnly</outbound-certificate-validation>
      <allow-unencrypted-null-cipher>false</allow-unencrypted-null-cipher>
      <use-server-certs>false</use-server-certs>
    </ssl>
    <listen-port>7021</listen-port>
    <listen-port-enabled>true</listen-port-enabled>

    <web-server>
      <web-server-log>
        <buffer-size-kb>0</buffer-size-kb>
      </web-server-log>
    </web-server>

    <listen-address></listen-address>
    <java-compiler>javac</java-compiler>
    <client-cert-proxy-enabled>false</client-cert-proxy-enabled>
  </server>

In the above, it is for the AdminServer. I think this can be done for other servers.

No comments:

Post a Comment