[ 
https://issues.apache.org/jira/browse/STORM-1552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15147698#comment-15147698
 ] 

ASF GitHub Bot commented on STORM-1552:
---------------------------------------

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

    https://github.com/apache/storm/pull/1109#discussion_r52932760
  
    --- 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 --
    
    ConfigUtils.java is not available in 1.x-branch. I wanted the fix to be 
applied to both 1.x and master so took 1.x as the base and submitted the PR. 
Someone can let me know in such cases one need to raise two separate PRs with 
different code to fix the same issue.


> Fix topology event sampling log directory 
> ------------------------------------------
>
>                 Key: STORM-1552
>                 URL: https://issues.apache.org/jira/browse/STORM-1552
>             Project: Apache Storm
>          Issue Type: Bug
>    Affects Versions: 1.0.0, 2.0.0
>            Reporter: Arun Mahadevan
>            Assignee: Arun Mahadevan
>
> Run a topology and enable event inspection by clicking "Debug" from UI. The 
> events are logged under 
> "storm-local/workers-artifacts/{storm-id}/port/events.log". In the spout/bolt 
> details page, the "events" link does not display the log file.
> The events.log should be kept under 
> logs/workers-artifacts/{storm-id}/{port}/events.log so that its viewable via 
> logviewer.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to