Github user abhishekagarwal87 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1109#discussion_r52931701
  
    --- Diff: 
storm-core/src/jvm/org/apache/storm/metric/FileBasedEventLogger.java ---
    @@ -76,33 +77,35 @@ public void run() {
             scheduler.scheduleAtFixedRate(task, FLUSH_INTERVAL_MILLIS, 
FLUSH_INTERVAL_MILLIS, TimeUnit.MILLISECONDS);
         }
     
    +    private String getLogDir(Map stormConf) {
    +        String logDir;
    +        if ((logDir = System.getProperty("storm.log.dir")) == null
    +                && (logDir = (String) stormConf.get("storm.log.dir")) == 
null) {
    +            logDir = Paths.get(System.getProperty("storm.home"), 
"logs").toString();
    +        }
    +        return logDir;
    +    }
     
         @Override
         public void prepare(Map stormConf, TopologyContext context) {
    -        String logDir; // storm local directory
    +        String workersArtifactDir; // workers artifact directory
             String stormId = context.getStormId();
             int port = context.getThisWorkerPort();
    -        if ((logDir = System.getProperty("storm.local.dir")) == null &&
    -                (logDir = (String)stormConf.get("storm.local.dir")) == 
null) {
    -            String msg = "Could not determine the directory to log 
events.";
    -            LOG.error(msg);
    -            throw new RuntimeException(msg);
    -        } else {
    -            LOG.info("FileBasedEventLogger log directory {}.", logDir);
    +        if ((workersArtifactDir = (String) 
stormConf.get(Config.STORM_WORKERS_ARTIFACTS_DIR)) == null) {
    +            workersArtifactDir = "workers-artifacts";
             }
    -
             /*
              * Include the topology name & worker port in the file name so that
              * multiple event loggers can log independently.
              */
    -        Path path = Paths.get(logDir, "workers-artifacts", stormId, 
Integer.toString(port), "events.log");
    +        Path path = Paths.get(workersArtifactDir, stormId, 
Integer.toString(port), "events.log");
             if (!path.isAbsolute()) {
    -            path = Paths.get(System.getProperty("storm.home"), logDir, 
"workers-artifacts",
    -                    stormId, Integer.toString(port), "events.log");
    +            path = Paths.get(getLogDir(stormConf), workersArtifactDir,
    --- End diff --
    
    This is very similar to 
https://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/utils/ConfigUtils.java#L407



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to