错误无法实例化类[org.apache.log4j.rolling.RollingFileAppender]

时间:2018-07-06 10:19:34

标签: java log4j

我正在使用log4j-1.2.17.jar和apache-log4j-extras-1.2.17.jar。

我想启用滚动文件,但是当我尝试启动服务器y时出现错误。

import 'dart:math';

import 'package:flutter/material.dart';

class _ArcPainter extends CustomPainter {
  _ArcPainter();

  @override
  bool shouldRepaint(_ArcPainter oldDelegate) {
    return true;
  }

  @override
  void paint(Canvas canvas, Size size) {
    Rect rect = Rect.fromLTWH(0.0, 0.0, size.width, size.height);

    Path path = Path()..arcTo(rect, 0.0, -pi / 2, true);
    canvas.drawPath(
        path,
        Paint()
          ..color = Colors.orange
          ..strokeWidth = 3.0
          ..style = PaintingStyle.stroke);

    canvas.drawArc(
        rect,
        0.0,
        pi / 2,
        false,
        Paint()
          ..color = Colors.teal
          ..strokeWidth = 3.0
          ..style = PaintingStyle.stroke);
  }
}

class ArcWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new SizedBox(
      width: 250.0,
      height: 250.0,
      child: new CustomPaint(
        painter: new _ArcPainter(),
      ),
    );
  }
}

class SegmentDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: AppBar(title: const Text('Arcs etc')),
      body: ArcWidget(),
    );
  }
}

void main() {
  runApp(
    MaterialApp(
      home: SegmentDemo(),
    ),
  );
}

错误:

My log4j.properties file looks like this.

log4j.appender.LOG_CRON_SIJ=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.LOG_CRON_SIJ.append=true
log4j.appender.LOG_CRON_SIJ.encoding=UTF-8
log4j.appender.LOG_CRON_SIJ.rollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy
log4j.appender.LOG_CRON_SIJ.rollingPolicy.FileNamePattern=${rootLog}/agendaNojCRONSIJ_%d{dd-MM-yyyy HH-mm-ss}.log
log4j.appender.LOG_CRON_SIJ.rollingPolicy.activeFileName=${rootLog}/agendaNojCRONSIJ.log
log4j.appender.LOG_CRON_SIJ.triggeringPolicy=org.apache.log4j.rolling.SizeBasedTriggeringPolicy
log4j.appender.LOG_CRON_SIJ.triggeringPolicy.maxFileSize=52428800
log4j.appender.LOG_CRON_SIJ.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.LOG_CRON_SIJ.layout.ConversionPattern=%d %-5p %c - %m%n

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

请检查类路径中的RollingFileAppender (Apache Log4j 1.2.17 API)是否具有必需的依赖项。如果您在类路径中找不到任何实例化的类,而该类实际上是在某个地方实例化的,则您将遇到此类错误。因此,请检查日志记录依赖性。