watchzerg
watchzerg

Reputation: 662

logback: CyclicBufferTracker.setMaxNumberOfBuffers() removed while official doc still refering it. what's alternative please?

I'm use SMTPAppender in logback, and configured like this:

<appender name="ALARM-APPENDER" class="ch.qos.logback.classic.net.SMTPAppender">
  ...
  <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker">
    <maxNumberOfBuffers>256</maxNumberOfBuffers>
  </cyclicBufferTracker>
  ...
</appender>  

but I got this error while running:

10:00:48,171 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@82:24 - no applicable action for [maxNumberOfBuffers], current ElementPath is [[configuration][appender][cyclicBufferTracker][maxNumberOfBuffers]]

So I rechecked official manual:
http://logback.qos.ch/manual/appenders.html#bufferManagement
It didn't tell where maxNumberOfBuffers should be config to.

Fortunately, I find a config example in official doc: http://logback.qos.ch/recipes/emailPerTransaction.html

<cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker">
    <maxNumberOfBuffers>512</maxNumberOfBuffers>
</cyclicBufferTracker>

Looks the same...

Then I checked latest java-doc for Class CyclicBufferTracker:
http://logback.qos.ch/apidocs/ch/qos/logback/core/spi/CyclicBufferTracker.html
No "setMaxNumberOfBuffers" method here or in it's parent Classes.

As last resorts, I checked the source code changing history in github:
https://github.com/qos-ch/logback/blob/a052f15d09636698c96fcdb753da3270f5c01b11/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTracker.java
In the original version,when it's still a interface, there are both "setMaxNumberOfBuffers" and "setBufferSize" method in it.

https://github.com/qos-ch/logback/commit/773193a09922ab2a1dd70e4978be8cdf4e050f6e
Apr 25, 2013, method "setMaxNumberOfBuffers" was removed.

Now there is a problem: where should I config "setMaxNumberOfBuffers" to?
("setMaxNumberOfBuffers" has totally differet meaning from "setBufferSize")

It's can't even find and "maxNumberOfBuffers" String in logback's repository:
https://github.com/qos-ch/logback/search?q=maxNumberOfBuffers

I'm using lastest version of logback(1.1.2) by the way.
Thanks guys!

Upvotes: 1

Views: 711

Answers (1)

alsid
alsid

Reputation: 490

Make sure that the latest version is used. Got the same problem but with bufferSize property for logback version 1.0.9. After some research found this bug report.
After updating to the latest version problem dissappeared.

Upvotes: 0

Related Questions