hdinsight / hdinsight-storm-examples

This is a repository for complete and easy to use samples that demonstrate the use of Apache Storm on HDInsight
Apache License 2.0
59 stars 52 forks source link

Where logs are writing? #7

Closed dsevastianov closed 9 years ago

dsevastianov commented 9 years ago

Hi, more of a question, is there a way to see what Context.Logger outputs in topology running on Storm?

ravitandonrt commented 9 years ago

For SCP.Net I had posted about logs in this MSDN forum post: https://social.msdn.microsoft.com/Forums/azure/en-US/8a1b48a3-2617-4a2c-980f-4022005a9afa/question-about-logging-in-storm-with-hdinsight?forum=hdinsight

Few excerpts from the post:

Future:

We also investigating other ways to expose these logs in a better and more accessible way. Feedback and suggestions are welcome!

dsevastianov commented 9 years ago

Thank you

ravitandonrt commented 9 years ago

@dsevastianov - Next NuGet update of SCP.Net will help you get the logs of SCP.Net in your Java Worker logs.

How to get them now? SCP.NET logs logged using Context.Logger can be displayed in Storm worker log files now, you will be also able to see them from VS/Storm UI.

There are two log pipelines from SCP.NET process to Storm worker, one is for STDERR, the other is for STDOUT.

You can control the log level of each pipeline by changing the threshold of ConsoleAppenderError and ConsoleAppender, which can defined in Microsoft.SCP.Net.SDK\sdk\Microsoft.SCPNet.dll.config.

Add these appenders to the log4net section:

<log4net>
    <appender name="ConsoleAppenderError" type="log4net.Appender.ConsoleAppender">
      <threshold value="ERROR"/>
      <target value="Console.Error" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="[%thread] %-5level %logger - %message%newline" />
      </layout>
    </appender>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
      <threshold value="INFO"/>
      <target value="Console.Out" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="[%thread] %-5level %logger - %message%newline" />
      </layout>
    </appender>

Add these appenders in your root logger configuration to start seeing the logs.

    <root>
      <level value="INFO" />
      <appender-ref ref="ConsoleAppenderError" />
      <appender-ref ref="ConsoleAppender" />

You can checkout the same in this template: https://github.com/hdinsight/hdinsight-storm-examples/blob/master/templates/AzureEventHubsReaderStormApplication/Microsoft.SCPNet.dll.config

dsevastianov commented 9 years ago

Thank you Ravi