[
https://issues.apache.org/jira/browse/STORM-1552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15150056#comment-15150056
]
ASF GitHub Bot commented on STORM-1552:
---------------------------------------
Github user abhishekagarwal87 commented on a diff in the pull request:
https://github.com/apache/storm/pull/1109#discussion_r53129789
--- 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 --
I would be fine with different code. But if it is decided to keep the code
same, please add a to-do here.
> 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)