Bug 40385 - SocketServer cannot find config file when passed an IP address
Summary: SocketServer cannot find config file when passed an IP address
Status: NEEDINFO
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.3alpha
Hardware: PC Windows XP
: P2 major
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-01 09:15 UTC by Muxg
Modified: 2006-09-13 13:01 UTC (History)
0 users



Attachments
Uses InetAddress.getHostName() instead of parsing InetAddress.toString() (1.10 KB, patch)
2006-09-01 16:49 UTC, Curt Arnold
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Muxg 2006-09-01 09:15:49 UTC
org.apache.log4j.net.SocketServer
method:
LoggerRepository configureHierarchy(InetAddress inetAddress) {
        cat.info("Locating configuration file for " + inetAddress);
        // We assume that the toSting method of InetAddress returns is in
        // the format hostname/d1.d2.d3.d4 e.g. torino/192.168.1.1
        String s = inetAddress.toString();
        int i = s.indexOf("/");
        if (i == -1) {
            ...
        } else {
            /*****************************/
            /**if my inetAddress.toString()="/192.168.1.1";
               key = ""; 
            */
            String key = s.substring(0, i);
            //Filename = ".lcf",but has no name.
            /*****************************/
            File configFile = new File(dir, key + CONFIG_FILE_EXT);
                }
Comment 1 Curt Arnold 2006-09-01 16:49:53 UTC
Created attachment 18804 [details]
Uses InetAddress.getHostName() instead of parsing InetAddress.toString()
Comment 2 Curt Arnold 2006-09-01 16:50:29 UTC
The assumption of a format for InetAddress.toString() and parsing I assume is the problem.  I've changed 
the name of the bug report to reflect my understanding of the problem you've reported.  I've also attached 
a patch, could you review and see if it addresses the problem that you are encountering.  If not, please 
attach a patch that does or describe the problem more fully and your desired resolution.