久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Apache Commons Net 中為 FTP 協(xié)議啟用日志記錄

Enable logging in Apache Commons Net for FTP protocol(在 Apache Commons Net 中為 FTP 協(xié)議啟用日志記錄)
本文介紹了在 Apache Commons Net 中為 FTP 協(xié)議啟用日志記錄的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

Apache Commons Net 庫似乎沒有向任何記錄器"發(fā)送任何內(nèi)容.

Apache Commons Net library does not seem to send anything to any "logger".

我能否以某種方式從 (FTP) 會話中獲取日志文件以進(jìn)行調(diào)試?例如來自服務(wù)器的原始 FTP 命令和響應(yīng),如下所示:

Can I somehow obtain a log file from an (FTP) session, for debugging purposes? For example raw FTP commands and responses from the server, like this:

220 Welcome
USER *******
331 Password required for ...
PASS *******
230 Logged on
TYPE I
200 Type set to I
QUIT
221 Goodbye

推薦答案

Apache Commons Net 中的所有協(xié)議實現(xiàn),包括 FTPClient,都派生自 SocketClient,它有一個方法<代碼>addProtocolCommandListener.您可以將 ProtocolCommandListener 實現(xiàn)日志記錄.

All protocol implementations in Apache Commons Net, including FTPClient, derive from SocketClient, which has a method addProtocolCommandListener. You can pass it an implementation of ProtocolCommandListener to implement logging.

有一個現(xiàn)成的實現(xiàn) PrintCommandListener,將協(xié)議日志打印到提供的PrintStream.

使用這樣的代碼:

ftpClient.addProtocolCommandListener(
    new PrintCommandListener(
        new PrintWriter(new OutputStreamWriter(System.out, "UTF-8")), true));

...,您將得到您所要求的準(zhǔn)確輸出.

..., you will get exactly the output that you have asked for.

這篇關(guān)于在 Apache Commons Net 中為 FTP 協(xié)議啟用日志記錄的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環(huán)繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數(shù)據(jù)庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 爱爱综合网 | 久久久人成影片免费观看 | 日韩av在线一区 | 日韩精品二区 | 国产在线视频99 | av在线免费观看网站 | 99久久久国产精品 | 久久精品91久久久久久再现 | av一级毛片| 97超碰免费 | 日韩欧美在线视频 | 久久久久久久电影 | 最新日韩欧美 | 中文字幕在线一区二区三区 | 免费观看国产视频在线 | 天堂素人约啪 | 亚洲日本视频 | 国产成人精品久久二区二区91 | 亚洲国产精品久久人人爱 | 欧美日韩精品一区二区三区四区 | 成人综合视频在线观看 | 国产欧美在线一区二区 | 一区二区高清 | 免费观看一级毛片 | 四虎影视免费在线 | 麻豆久久久久 | 国产三级| 精品一区二区三区日本 | 国产精品1区2区3区 中文字幕一区二区三区四区 | 色爽女 | 日本小视频网站 | 亚洲一二三区av | 国产成人免费视频网站视频社区 | 精品国产乱码久久久久久果冻传媒 | 一区久久| 日韩av免费在线观看 | 亚洲 成人 在线 | 亚洲资源在线 | 国产精品一区二区在线播放 | 国产精品久久久久久久一区二区 | 成人国产精品久久久 |