Skip to content

Commit ae80490

Browse files
committed
Add debug logging for SMB/FTP authentications in FileConfig
1 parent caa33de commit ae80490

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/main/java/org/codelibs/fess/opensearch/config/exentity/FileConfig.java

+20
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import java.util.function.Supplier;
2525
import java.util.regex.Pattern;
2626

27+
import org.apache.logging.log4j.LogManager;
28+
import org.apache.logging.log4j.Logger;
2729
import org.codelibs.core.lang.StringUtil;
2830
import org.codelibs.fess.Constants;
2931
import org.codelibs.fess.app.service.FileAuthenticationService;
@@ -40,6 +42,8 @@
4042
*/
4143
public class FileConfig extends BsFileConfig implements CrawlingConfig {
4244

45+
private static final Logger logger = LogManager.getLogger(FileConfig.class);
46+
4347
private static final long serialVersionUID = 1L;
4448

4549
protected volatile Pattern[] includedDocPathPatterns;
@@ -167,6 +171,10 @@ public CrawlerClientFactory initializeClientFactory(final Supplier<CrawlerClient
167171
final List<org.codelibs.fess.crawler.client.smb1.SmbAuthentication> smb1AuthList = new ArrayList<>();
168172
final List<FtpAuthentication> ftpAuthList = new ArrayList<>();
169173
for (final FileAuthentication fileAuth : fileAuthList) {
174+
if (logger.isDebugEnabled()) {
175+
logger.debug("FileAuthentication: " + fileAuth.getProtocolScheme() + " " + fileAuth.getHostname() + ":" + fileAuth.getPort()
176+
+ " " + fileAuth.getUsername());
177+
}
170178
if (Constants.SAMBA.equals(fileAuth.getProtocolScheme())) {
171179
final SmbAuthentication smbAuth = new SmbAuthentication();
172180
final Map<String, String> map = ParameterUtil.parse(fileAuth.getParameters());
@@ -196,9 +204,21 @@ public CrawlerClientFactory initializeClientFactory(final Supplier<CrawlerClient
196204
}
197205
}
198206
paramMap.put(Param.Client.SMB_AUTHENTICATIONS, smbAuthList.toArray(new SmbAuthentication[smbAuthList.size()]));
207+
if (logger.isDebugEnabled()) {
208+
smbAuthList.forEach(smbAuth -> logger
209+
.debug("SmbAuthentication: " + smbAuth.getServer() + ":" + smbAuth.getPort() + " " + smbAuth.getUsername()));
210+
}
199211
paramMap.put(Param.Client.SMB1_AUTHENTICATIONS,
200212
smb1AuthList.toArray(new org.codelibs.fess.crawler.client.smb1.SmbAuthentication[smb1AuthList.size()]));
213+
if (logger.isDebugEnabled()) {
214+
smb1AuthList.forEach(smb1Auth -> logger
215+
.debug("Smb1Authentication: " + smb1Auth.getServer() + ":" + smb1Auth.getPort() + " " + smb1Auth.getUsername()));
216+
}
201217
paramMap.put(Param.Client.FTP_AUTHENTICATIONS, ftpAuthList.toArray(new FtpAuthentication[ftpAuthList.size()]));
218+
if (logger.isDebugEnabled()) {
219+
ftpAuthList.forEach(ftpAuth -> logger
220+
.debug("FtpAuthentication: " + ftpAuth.getServer() + ":" + ftpAuth.getPort() + " " + ftpAuth.getUsername()));
221+
}
202222

203223
crawlerClientFactory = factory;
204224
return factory;

0 commit comments

Comments
 (0)