简体   繁体   English

如何启用Apache FtpServer的日志记录

[英]How to enable logging for Apache FtpServer

I'm using the Apache FTPServer in my application. 我在应用程序中使用Apache FTPServer。 it work just fine the only issue; 唯一的问题就是工作正常; I don't know how to log the operation made on the application side like the downloaded files... 我不知道如何像下载文件一样记录应用程序侧的操作...

here is my source code 这是我的源代码

    public static void main(String[] args) throws FtpException {
    PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
    UserManager userManager = userManagerFactory.createUserManager();
    BaseUser user = new BaseUser();
    user.setName("test");
    user.setPassword("123456");
    user.setHomeDirectory("/ftp_data");
    userManager.save(user);

    ListenerFactory listenerFactory = new ListenerFactory();
    listenerFactory.setPort(21);

    FtpServerFactory factory = new FtpServerFactory();
    factory.setUserManager(userManager);
    factory.addListener("default", listenerFactory.createListener());

    FtpServer server = factory.createServer();
    server.start();
}

any Ideas? 有任何想法吗?

Since the Apache FTPServer use Log4j you can configure your log4j.properties files to use it in your project, 由于Apache FTPServer使用Log4j,因此您可以配置log4j.properties文件以在项目中使用它,

Here is how to do it . 这是怎么做的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM