hotfix: xxl日志文件不存在的问题
This commit is contained in:
parent
389047223d
commit
0d8d2734f8
@ -1,12 +1,16 @@
|
||||
package cn.axzo.im.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.xxl.job.core.log.XxlJobFileAppender;
|
||||
|
||||
import ch.qos.logback.core.Layout;
|
||||
import ch.qos.logback.core.UnsynchronizedAppenderBase;
|
||||
import ch.qos.logback.core.encoder.Encoder;
|
||||
import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
|
||||
import com.xxl.job.core.log.XxlJobFileAppender;
|
||||
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
@ -27,7 +31,9 @@ public class XxlAppender<E> extends UnsynchronizedAppenderBase<E> {
|
||||
@Override
|
||||
protected void append(E event) {
|
||||
String logFileName = XxlJobFileAppender.contextHolder.get();
|
||||
if (logFileName == null) return;
|
||||
if (StringUtils.isBlank(logFileName)) return;
|
||||
File file = new File(logFileName);
|
||||
if (!file.exists()) return;
|
||||
if (encoder == null) return;
|
||||
byte[] bytes = encoder.encode(event);
|
||||
String message = new String(bytes);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user