1

In Weblogic if I want to save the log files by more than one rotation type, is that possible? I want to make the logs with the maximum size of 5Mb, but if they doen't reach the maximum size I want then to rotate by day. Is this possible?

<log>
  <file-name>logs/examplesServer.log</file-name>
  <rotation-type>byTime</rotation-type>
  <number-of-files-limited>true</number-of-files-limited>
  <file-time-span>24</file-time-span>
  <rotation-time>00:00</rotation-time>
  <rotate-log-on-startup>true</rotate-log-on-startup>
  <logger-severity>Info</logger-severity>
  <log-file-severity>Debug</log-file-severity>
  <stdout-severity>Notice</stdout-severity>
  <domain-log-broadcast-severity>Notice</domain-log-broadcast-severity>
  <memory-buffer-severity>Trace</memory-buffer-severity>
  <log4j-logging-enabled>false</log4j-logging-enabled>
  <redirect-stdout-to-server-log-enabled>false</redirect-stdout-to-server-log-enabled>
  <domain-log-broadcaster-buffer-size>1</domain-log-broadcaster-buffer-size>
</log>
user2091010
  • 85
  • 1
  • 2
  • 7

2 Answers2

2

By default - no - you cannot use both types of logging.

Setting a size limit Requires that you specify a file rotation type of Size.

Setting a rotation interval Requires that you specify a file rotation type of TIME.

However, if you're running your own application/deployment, you could do something like creating your own log4j appender to handle it. See:

How do you get log4j to roll files based on date and size?

What is the configuration in log4j.xml for rotating the logs based on time as well as size

Community
  • 1
  • 1
Display Name is missing
  • 6,197
  • 3
  • 34
  • 46
1

WebLogic can't do both, but I've used the Linux/Uix utility logrotate in that past to rotate stdout redirected to a file ...

/domains/soa_domain/servers/osb_server/logs/osb_server.out {
    missingok
    size 48M
    copytruncate
    rotate 8
}

... so adding the 'daily' directive and turning off log rotation in the domain (and referenceing the server log file obviously!), should do what you're after. This won't help if your domain is running on Windows though.

Jeremy Gosling
  • 1,130
  • 10
  • 11