The code below uses the Microsoft Enterprise Logging Application Block. How do you do it "better"?
using Microsoft.Practices.EnterpriseLibrary.Logging; class Program { static void Main(string[] args) { try { // Trying to write some data to the DB ... } catch (Exception ex) { LogHelper.LogException(ex, "Trying to write to the DB"); } } } public class LogHelper { public static void LogException(Exception ex, string exceptionType) { try { // Simplified version, only logging the message Logger.Write(exceptionType); } catch { // What do you do here??? } } }
See the answers in my related question :
, " " catch. , . , , , , .
() .
. - ( ). , .
, , .
, , IMHO.
, , . , , , , . , , . 3 . , db catch, , , , - db. , catch db. - , , , .
Source: https://habr.com/ru/post/1705735/More articles:PHP error in .xml file? - xmlif the file is a link to the LINUX OS - scriptingGet proc selection output schema - sql-serverCustom menu / context menu Mouse or right click - jqueryMessage Driven Bean Selectors (JMS) - javaDynamically change jmsSelector - javahttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1705737/can-javas-desktop-library-launch-a-url-in-a-new-browser-tab-or-window&usg=ALkJrhjsK4pg1mdzXzkHuqR4zkPZMsX1oAThe collateral method is called - javaUpdates ItemsSource + Converter + Treeview - converterWhat is the best exception handling strategy for error logging classes? - .netAll Articles