SlideShare a Scribd company logo
1 of 24
MojoPortal and log4net Steve Land StrongEye Solutions LLC VerifiedAD.com
Viewing logs in MojoPortal
currentlog.config
Log4net.config
Logging vs. Debugging
 Everyone likes to write a logging framework “Writing your own logging framework is the perfect coding crime. If you can convince your manager to put it on the project plan, you are guaranteed to have success. At the end of each day, you will go home feeling happy and satisfied. It will feel like you are doing something creative. You will get the intellectual stimulation without the risk of failure.”  Dr. Heinz M. Kabutz, The Java Specialists Newsletter Stan Wagon, Prof. of Mathematics and Computer Science, Macalester College, St. Paul, Minnesotahttp://decision-making.moshe-online.com/wheel.html
Basic concepts Tracing Dump every action and step, timestamped Logging Log business process steps Error Reporting / Debugging Log exceptions, unexpected cases
Log4Net features Log to multiple targets per log via Appenders Configurable message format Different logging levels off, fatal, error, warn, info, debug, and all Each logger has its own logging level Runtime control on which statements are printed Filters allow you to add conditions to Appenders to restrict what data gets written
http://www.codeproject.com/KB/cs/log4net_XmlConfigurator.aspx#objects
Good things to log Startup / shutdown of application Object creation Scarce resource allocation Failures (recoverable / unrecoverable) How long performance-critical operations took
Levels and tips ALL DEBUG INFO WARN ERROR FATAL OFF Tips generally follow http://commons.apache.org/logging/guide.html Selected level  and above  are reported
DEBUG level Detailed information on the flow through the system.  Expected exceptions that users of your code should handle. Logging details that you would not expect to see in production.
INFO level You generally want exception information available in production without having to turn on DEBUG log level. Log as INFO with stack trace and generally re-throw the exception. Components that rely on network boundaries should use INFO, don’t assume exceptions will make it to other components. Logging details that may be useful in production during troubleshooting.
WARN level Use of deprecated APIs, poor usage of APIs, “almost” errors, other unexpected and undesirable runtime situations that are not necessarily “wrong”
ERROR level Other runtime errors or unexpected conditions that may not cause premature termination.
FATAL level Severe errors that cause premature termination.
Things to be careful about Ensure logs don’t contain sensitive data Consider how attackers could use logs to defeat your software. Don’t reveal more information than necessary. Recursive code with logging Definitions of levels Not too much logging When performance is important, don’t create logging related objects if logging is turned off
Appenders In the box AdoNetAppender AspNetTraceAppender ConsoleAppender DebugAppender EventLogAppender FileAppender MemoryAppender RemotingAppender RollingFileAppender (  MojoPortal default) SmtpAppender SmtpPickupDirAppender … and more Or, make your own Start from scratch (probably don’t need to do this) Start from existing Appenderoverride methods that don’t do exactly what you want
Locking Models (for file appenders) MinimalLock: Opens the file once for each cycle. Slower but allows other processes to move/delete the log while logging ExclusiveLock: Opens the file once for writing and holds it open until CloseFile is called. Higher performance, but not appropriate for Web applications.
Layouts The recognized conversion pattern names are: log4net.Layout.PatternLayoutsee http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html
Demo
Thanks! Steve Land StrongEye Solutions VerifiedAD.com

More Related Content

What's hot

Integrating LAMP with Mkahawa Cyber Manager & SQLite
Integrating LAMP with Mkahawa Cyber Manager & SQLiteIntegrating LAMP with Mkahawa Cyber Manager & SQLite
Integrating LAMP with Mkahawa Cyber Manager & SQLite
jgarifuna
 

What's hot (16)

Writing External Rsyslog Plugins
Writing External Rsyslog PluginsWriting External Rsyslog Plugins
Writing External Rsyslog Plugins
 
40+ tips to use Postman more efficiently
40+ tips to use Postman more efficiently40+ tips to use Postman more efficiently
40+ tips to use Postman more efficiently
 
Rsyslog log normalization
Rsyslog log normalizationRsyslog log normalization
Rsyslog log normalization
 
Elk devops
Elk devopsElk devops
Elk devops
 
Kiwipycon command line
Kiwipycon command lineKiwipycon command line
Kiwipycon command line
 
PHP Conference - Phalcon hands-on
PHP Conference - Phalcon hands-onPHP Conference - Phalcon hands-on
PHP Conference - Phalcon hands-on
 
Flyr PHP micro-framework
Flyr PHP micro-frameworkFlyr PHP micro-framework
Flyr PHP micro-framework
 
"How about no grep and zabbix?". ELK based alerts and metrics.
"How about no grep and zabbix?". ELK based alerts and metrics."How about no grep and zabbix?". ELK based alerts and metrics.
"How about no grep and zabbix?". ELK based alerts and metrics.
 
FxUG@北陸資料
FxUG@北陸資料FxUG@北陸資料
FxUG@北陸資料
 
Postman Collection Format v2.0 (pre-draft)
Postman Collection Format v2.0 (pre-draft)Postman Collection Format v2.0 (pre-draft)
Postman Collection Format v2.0 (pre-draft)
 
Integrating LAMP with Mkahawa Cyber Manager & SQLite
Integrating LAMP with Mkahawa Cyber Manager & SQLiteIntegrating LAMP with Mkahawa Cyber Manager & SQLite
Integrating LAMP with Mkahawa Cyber Manager & SQLite
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
 
ASP.NET WEB API Training
ASP.NET WEB API TrainingASP.NET WEB API Training
ASP.NET WEB API Training
 
Fedora Developer's Conference 2014 Talk
Fedora Developer's Conference 2014 TalkFedora Developer's Conference 2014 Talk
Fedora Developer's Conference 2014 Talk
 
The ELK Stack - Get to Know Logs
The ELK Stack - Get to Know LogsThe ELK Stack - Get to Know Logs
The ELK Stack - Get to Know Logs
 
The rsyslog v8 engine (developer's view)
The rsyslog v8 engine (developer's view)The rsyslog v8 engine (developer's view)
The rsyslog v8 engine (developer's view)
 

Similar to MojoPortal And Log4net

Developer Fundamentals - Logging
Developer Fundamentals - LoggingDeveloper Fundamentals - Logging
Developer Fundamentals - Logging
Axel Irriger
 
The importance of logs - DefCamp 2012
The importance of logs - DefCamp 2012The importance of logs - DefCamp 2012
The importance of logs - DefCamp 2012
DefCamp
 
Error management
Error managementError management
Error management
daniil3
 
Troubleshooting Plone
Troubleshooting PloneTroubleshooting Plone
Troubleshooting Plone
Ricado Alves
 

Similar to MojoPortal And Log4net (20)

Building of systems of automatic C/C++ code logging
Building of systems of automatic C/C++ code loggingBuilding of systems of automatic C/C++ code logging
Building of systems of automatic C/C++ code logging
 
Functional and non functional application logging
Functional and non functional application loggingFunctional and non functional application logging
Functional and non functional application logging
 
Un-broken Logging - Operability.io 2015 - Matthew Skelton
Un-broken Logging - Operability.io 2015 - Matthew SkeltonUn-broken Logging - Operability.io 2015 - Matthew Skelton
Un-broken Logging - Operability.io 2015 - Matthew Skelton
 
Un-broken logging - the foundation of software operability - Operability.io -...
Un-broken logging - the foundation of software operability - Operability.io -...Un-broken logging - the foundation of software operability - Operability.io -...
Un-broken logging - the foundation of software operability - Operability.io -...
 
WoMakersCode 2016 - Shit Happens
WoMakersCode 2016 -  Shit HappensWoMakersCode 2016 -  Shit Happens
WoMakersCode 2016 - Shit Happens
 
Developer Fundamentals - Logging
Developer Fundamentals - LoggingDeveloper Fundamentals - Logging
Developer Fundamentals - Logging
 
TDC 2015 - POA - Trilha PHP - Shit Happens
TDC 2015 - POA - Trilha PHP - Shit HappensTDC 2015 - POA - Trilha PHP - Shit Happens
TDC 2015 - POA - Trilha PHP - Shit Happens
 
A Bug Tracking System Is A Software Application
A Bug Tracking System Is A Software ApplicationA Bug Tracking System Is A Software Application
A Bug Tracking System Is A Software Application
 
Marjan.nikolovski down the rabbit hole error handling examined-v01
Marjan.nikolovski down the rabbit hole   error handling examined-v01Marjan.nikolovski down the rabbit hole   error handling examined-v01
Marjan.nikolovski down the rabbit hole error handling examined-v01
 
How to Use OWASP Security Logging
How to Use OWASP Security LoggingHow to Use OWASP Security Logging
How to Use OWASP Security Logging
 
Un-broken Logging - TechnologyUG - Leeds - Matthew Skelton
Un-broken Logging - TechnologyUG - Leeds - Matthew SkeltonUn-broken Logging - TechnologyUG - Leeds - Matthew Skelton
Un-broken Logging - TechnologyUG - Leeds - Matthew Skelton
 
How to Build a Pure Evil Magento Module
How to Build a Pure Evil Magento ModuleHow to Build a Pure Evil Magento Module
How to Build a Pure Evil Magento Module
 
The importance of logs - DefCamp 2012
The importance of logs - DefCamp 2012The importance of logs - DefCamp 2012
The importance of logs - DefCamp 2012
 
Application Logging Good Bad Ugly ... Beautiful?
Application Logging Good Bad Ugly ... Beautiful?Application Logging Good Bad Ugly ... Beautiful?
Application Logging Good Bad Ugly ... Beautiful?
 
Lightning Talk: JavaScript Error Handling
Lightning Talk: JavaScript Error HandlingLightning Talk: JavaScript Error Handling
Lightning Talk: JavaScript Error Handling
 
Error management
Error managementError management
Error management
 
jDriver Presentation
jDriver PresentationjDriver Presentation
jDriver Presentation
 
Troubleshooting Plone
Troubleshooting PloneTroubleshooting Plone
Troubleshooting Plone
 
Praesidio - Log.error("impossible-")
Praesidio - Log.error("impossible-")Praesidio - Log.error("impossible-")
Praesidio - Log.error("impossible-")
 
ISV Error Handling With Spring '21 Update
ISV Error Handling With Spring '21 UpdateISV Error Handling With Spring '21 Update
ISV Error Handling With Spring '21 Update
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

MojoPortal And Log4net

  • 1. MojoPortal and log4net Steve Land StrongEye Solutions LLC VerifiedAD.com
  • 2.
  • 3. Viewing logs in MojoPortal
  • 7.  Everyone likes to write a logging framework “Writing your own logging framework is the perfect coding crime. If you can convince your manager to put it on the project plan, you are guaranteed to have success. At the end of each day, you will go home feeling happy and satisfied. It will feel like you are doing something creative. You will get the intellectual stimulation without the risk of failure.” Dr. Heinz M. Kabutz, The Java Specialists Newsletter Stan Wagon, Prof. of Mathematics and Computer Science, Macalester College, St. Paul, Minnesotahttp://decision-making.moshe-online.com/wheel.html
  • 8. Basic concepts Tracing Dump every action and step, timestamped Logging Log business process steps Error Reporting / Debugging Log exceptions, unexpected cases
  • 9. Log4Net features Log to multiple targets per log via Appenders Configurable message format Different logging levels off, fatal, error, warn, info, debug, and all Each logger has its own logging level Runtime control on which statements are printed Filters allow you to add conditions to Appenders to restrict what data gets written
  • 11. Good things to log Startup / shutdown of application Object creation Scarce resource allocation Failures (recoverable / unrecoverable) How long performance-critical operations took
  • 12. Levels and tips ALL DEBUG INFO WARN ERROR FATAL OFF Tips generally follow http://commons.apache.org/logging/guide.html Selected level and above are reported
  • 13. DEBUG level Detailed information on the flow through the system. Expected exceptions that users of your code should handle. Logging details that you would not expect to see in production.
  • 14. INFO level You generally want exception information available in production without having to turn on DEBUG log level. Log as INFO with stack trace and generally re-throw the exception. Components that rely on network boundaries should use INFO, don’t assume exceptions will make it to other components. Logging details that may be useful in production during troubleshooting.
  • 15. WARN level Use of deprecated APIs, poor usage of APIs, “almost” errors, other unexpected and undesirable runtime situations that are not necessarily “wrong”
  • 16. ERROR level Other runtime errors or unexpected conditions that may not cause premature termination.
  • 17. FATAL level Severe errors that cause premature termination.
  • 18. Things to be careful about Ensure logs don’t contain sensitive data Consider how attackers could use logs to defeat your software. Don’t reveal more information than necessary. Recursive code with logging Definitions of levels Not too much logging When performance is important, don’t create logging related objects if logging is turned off
  • 19.
  • 20. Appenders In the box AdoNetAppender AspNetTraceAppender ConsoleAppender DebugAppender EventLogAppender FileAppender MemoryAppender RemotingAppender RollingFileAppender (  MojoPortal default) SmtpAppender SmtpPickupDirAppender … and more Or, make your own Start from scratch (probably don’t need to do this) Start from existing Appenderoverride methods that don’t do exactly what you want
  • 21. Locking Models (for file appenders) MinimalLock: Opens the file once for each cycle. Slower but allows other processes to move/delete the log while logging ExclusiveLock: Opens the file once for writing and holds it open until CloseFile is called. Higher performance, but not appropriate for Web applications.
  • 22. Layouts The recognized conversion pattern names are: log4net.Layout.PatternLayoutsee http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html
  • 23. Demo
  • 24. Thanks! Steve Land StrongEye Solutions VerifiedAD.com

Editor's Notes

  1. Sailors on early ships had no real way of knowing how fast they were traveling and how far they had gone in a specific period of time. So a system of measuring was devised, using a log of wood.The log had a weight tied to one end and a long rope attaching the other end to the stern, or back of the ship. The log floated behind the ship a certain distance, the length the rope was let out.Written accounts of speed Log Book
  2. AspNetTraceAppender outputs to trace screen of browser when @Page Trace=“true” setDebugAppender outputs events to the System.Diagnostics.Debug.Write(..) methodFileAppender has either Append or Overwrite modeMemoryAppender stores all to array, accessible via GetEvents() method RemotingAppender sends asynchronously