How to specify common application data folder for log4net?

We just use this: <param name=”File” value=”${ALLUSERSPROFILE}/Company/Product/Logs/error.log”/> It works great. This line can simply be inserted into your current appender configuration: <appender name=”RollingFileAppender” type=”log4net.Appender.RollingFileAppender”> <param name=”File” value=”${ALLUSERSPROFILE}/Company/Product/Logs/error.log”/> </appender>

Microsoft.Extensions.Logging Vs. NLog

With NLog you could do: var logger = NLog.LogManager.GetCurrentClassLogger(); logger.Info(“Hello {Name}”, “Earth”); That works for all platforms and all frameworks. Microsoft.Extensions.Logging With .NET Core, Microsoft introduced the ILogger abstraction from Microsoft.Extensions.Logging. You could use that logging abstraction in your project and integrate it with NLog. For example in ASP.NET Core you could inject Microsoft.Extensions.Logging.ILogger<HomeController> and … Read more

DCH class error with JavaMail

Add these before you send your message: MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); mc.addMailcap(“text/html;; x-java-content-handler=com.sun.mail.handlers.text_html”); mc.addMailcap(“text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml”); mc.addMailcap(“text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain”); mc.addMailcap(“multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed”); mc.addMailcap(“message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822”); CommandMap.setDefaultCommandMap(mc); I got the problem in my Android app and it works.

Traditional logging vs AOP logging

For performance, AOP approach certainly has a little overhead against the traditional one. One of the many strengths of AOP is that it allows you to separate your non-business concerns from your business logic. It also helps you in mundane tasks such putting a logging logic in each of your method or place a try-catch … Read more

How to log using log4j to local file system inside a Spark application that runs on YARN?

It looks like you’ll need to append to the JVM arguments used when launching your tasks/jobs. Try editing conf/spark-defaults.conf as described here spark.executor.extraJavaOptions=-Dlog4j.configuration=file:/apps/spark-1.2.0/conf/ spark.driver.extraJavaOptions=-Dlog4j.configuration=file:/apps/spark-1.2.0/conf/ Alternatively try editing conf/ as described here to add the same JVM argument, although the entries in conf/spark-defaults.conf should work. If you are still not getting any joy, you can explicitly … Read more

Location of GlassFish Server Logs

In general the logs are in /YOUR_GLASSFISH_INSTALL/glassfish/domains/domain1/logs/. In NetBeans go to the “Services” tab open “Servers”, right-click on your Glassfish instance and click “View Domain Server Log”. If this doesn’t work right-click on the Glassfish instance and click “Properties”, you can see the folder with the domains under “Domains folder”. Go to this folder -> … Read more