本文整理了Java中ch.qos.logback.core.util.FileSize.getSize()
方法的一些代码示例,展示了FileSize.getSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileSize.getSize()
方法的具体详情如下:
包路径:ch.qos.logback.core.util.FileSize
类名称:FileSize
方法名:getSize
暂无
代码示例来源:origin: SonarSource/sonarqube
@Test
public void createRollingPolicy_size() throws Exception {
props.set("sonar.log.rollingPolicy", "size:1MB");
props.set("sonar.log.maxFiles", "20");
LoggerContext ctx = underTest.getRootContext();
LogbackHelper.RollingPolicy policy = underTest.createRollingPolicy(ctx, props, "sonar");
Appender appender = policy.createAppender("SONAR_FILE");
assertThat(appender).isInstanceOf(RollingFileAppender.class);
// max 20 files of 1Mb
RollingFileAppender fileAppender = (RollingFileAppender) appender;
FixedWindowRollingPolicy rollingPolicy = (FixedWindowRollingPolicy) fileAppender.getRollingPolicy();
assertThat(rollingPolicy.getMaxIndex()).isEqualTo(20);
assertThat(rollingPolicy.getFileNamePattern()).endsWith("sonar.%i.log");
SizeBasedTriggeringPolicy triggeringPolicy = (SizeBasedTriggeringPolicy) fileAppender.getTriggeringPolicy();
FileSize maxFileSize = (FileSize) FieldUtils.readField(triggeringPolicy, "maxFileSize", true);
assertThat(maxFileSize.getSize()).isEqualTo(1024L * 1024);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public boolean isTriggeringEvent(final File activeFile, final E event) {
if(invocationGate.skipFurtherWork())
return false;
long now = System.currentTimeMillis();
invocationGate.updateMaskIfNecessary(now);
return (activeFile.length() >= maxFileSize.getSize());
}
代码示例来源:origin: camunda/camunda-bpm-platform
public boolean isTriggeringEvent(File activeFile, final E event) {
long time = getCurrentTime();
if (time >= nextCheck) {
Date dateInElapsedPeriod = dateInCurrentPeriod;
elapsedPeriodsFileName = tbrp.fileNamePatternWCS
.convertMultipleArguments(dateInElapsedPeriod, currentPeriodsCounter);
currentPeriodsCounter = 0;
setDateInCurrentPeriod(time);
computeNextCheck();
return true;
}
// for performance reasons, check for changes every 16,invocationMask invocations
if (((++invocationCounter) & invocationMask) != invocationMask) {
return false;
}
if (invocationMask < 0x0F) {
invocationMask = (invocationMask << 1) + 1;
}
if (activeFile.length() >= maxFileSize.getSize()) {
elapsedPeriodsFileName = tbrp.fileNamePatternWCS
.convertMultipleArguments(dateInCurrentPeriod, currentPeriodsCounter);
currentPeriodsCounter++;
return true;
}
return false;
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
protected boolean isUnboundedTotalSizeCap() {
return totalSizeCap.getSize() == UNBOUNDED_TOTAL_SIZE_CAP;
}
代码示例来源:origin: tony19/logback-android
protected boolean isUnboundedTotalSizeCap() {
return totalSizeCap.getSize() == UNBOUNDED_TOTAL_SIZE_CAP;
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
protected boolean isUnboundedTotalSizeCap() {
return totalSizeCap.getSize() == UNBOUNDED_TOTAL_SIZE_CAP;
}
代码示例来源:origin: Nextdoor/bender
protected boolean isUnboundedTotalSizeCap() {
return totalSizeCap.getSize() == UNBOUNDED_TOTAL_SIZE_CAP;
}
代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand
public boolean isTriggeringEvent(final File activeFile, final E event) {
// for performance reasons, check for changes every 16 invocations
if (((invocationCounter++) & 0xF) != 0xF) {
return false;
}
return (activeFile.length() >= maxFileSize.getSize());
}
代码示例来源:origin: tony19/logback-android
public boolean isTriggeringEvent(final File activeFile, final E event) {
long now = System.currentTimeMillis();
if (invocationGate.isTooSoon(now)) {
return false;
}
return (activeFile.length() >= maxFileSize.getSize());
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
public boolean isTriggeringEvent(final File activeFile, final E event) {
long now = System.currentTimeMillis();
if (invocationGate.isTooSoon(now))
return false;
return (activeFile.length() >= maxFileSize.getSize());
}
代码示例来源:origin: Nextdoor/bender
public boolean isTriggeringEvent(final File activeFile, final E event) {
long now = System.currentTimeMillis();
if (invocationGate.isTooSoon(now))
return false;
return (activeFile.length() >= maxFileSize.getSize());
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
public boolean isTriggeringEvent(final File activeFile, final E event) {
long now = System.currentTimeMillis();
if (invocationGate.isTooSoon(now))
return false;
return (activeFile.length() >= maxFileSize.getSize());
}
代码示例来源:origin: caskdata/cdap
@Override
public boolean isTriggeringEvent(final ILoggingEvent event) throws LogbackException {
return (getActiveLocationSize() >= maxFileSize.getSize());
}
代码示例来源:origin: co.cask.cdap/cdap-watchdog
@Override
public boolean isTriggeringEvent(final ILoggingEvent event) throws LogbackException {
return (getActiveLocationSize() >= maxFileSize.getSize());
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core
public boolean isTriggeringEvent(final File activeFile, final E event) {
if(invocationGate.skipFurtherWork())
return false;
long now = System.currentTimeMillis();
invocationGate.updateMaskIfNecessary(now);
return (activeFile.length() >= maxFileSize.getSize());
}
代码示例来源:origin: ch.qos.logback/core
public boolean isTriggeringEvent(final File activeFile, final E event) {
if(invocationGate.skipFurtherWork())
return false;
long now = System.currentTimeMillis();
invocationGate.updateMaskIfNecessary(now);
return (activeFile.length() >= maxFileSize.getSize());
}
代码示例来源:origin: com.hynnet/logback-core
public boolean isTriggeringEvent(final File activeFile, final E event) {
if(invocationGate.skipFurtherWork())
return false;
long now = System.currentTimeMillis();
invocationGate.updateMaskIfNecessary(now);
return (activeFile.length() >= maxFileSize.getSize());
}
代码示例来源:origin: org.jmxtrans/jmxtrans-output-log4j
protected Appender buildLog4jAppender(
String fileStr, FileSize maxLogFileSize,
Integer maxLogBackupFiles) throws IOException {
PatternLayout pl = new PatternLayout(LOG_PATTERN);
final RollingFileAppender appender = new RollingFileAppender(pl, fileStr, true);
appender.setImmediateFlush(true);
appender.setBufferedIO(false);
appender.setBufferSize(LOG_IO_BUFFER_SIZE_BYTES);
appender.setMaxFileSize(Long.toString(maxLogFileSize.getSize()));
appender.setMaxBackupIndex(maxLogBackupFiles);
return appender;
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
@Override
public void start() {
SizeAndTimeBasedFNATP<E> sizeAndTimeBasedFNATP = new SizeAndTimeBasedFNATP<E>(Usage.EMBEDDED);
if(maxFileSize == null) {
addError("maxFileSize property is mandatory.");
return;
} else {
addInfo("Archive files will be limited to ["+maxFileSize+"] each.");
}
sizeAndTimeBasedFNATP.setMaxFileSize(maxFileSize);
timeBasedFileNamingAndTriggeringPolicy = sizeAndTimeBasedFNATP;
if(!isUnboundedTotalSizeCap() && totalSizeCap.getSize() < maxFileSize.getSize()) {
addError("totalSizeCap of ["+totalSizeCap+"] is smaller than maxFileSize ["+maxFileSize+"] which is non-sensical");
return;
}
// most work is done by the parent
super.start();
}
代码示例来源:origin: tony19/logback-android
@Test
public void testFileSize() {
setter.setProperty("fs", "2 kb");
assertEquals(2 * 1024, house.getFs().getSize());
}
内容来源于网络,如有侵权,请联系作者删除!