Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

C# WinForm Write Text Log

Posted on July 31, 2014October 26, 2015 By David Kittell
public void LogMessage (string msg)
			{
			string sFilePath = Environment.CurrentDirectory + "Log_" + System.AppDomain.CurrentDomain.FriendlyName + ".txt";

			System.IO.StreamWriter sw = System.IO.File.AppendText(sFilePath);
			try
				{
				string logLine = System.String.Format(
					"{0:G}: {1}.", System.DateTime.Now, msg);
				sw.WriteLine(logLine);
				}
			finally
				{
				sw.Close();
				}
			}
LogMessage("Problem with program");
Originally Posted on July 31, 2014
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code CSharp

Post navigation

Previous post
Next post

Related Posts

Ektron – DMS Content List

Posted on October 31, 2014October 26, 2015

<%@ Page Title="" Language="C#" CodeFile="DMSFileList.aspx.cs" Inherits="DMSFileList" %> <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <meta charset="utf-8" /> <title>DMS File List</title> </head> <body> <form id="form1" runat="server"> <asp:Repeater ID="subContentRepeater" runat="server"> <HeaderTemplate> <table style="border: 1px solid #000000;"> <tr> <th>ID</th> <th>Type</th> <th>QuickLink</th> <th>Title</th> <th>Summary</th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td style="vertical-align: text-top;"> <%# DataBinder.Eval(Container.DataItem,…

Read More

DigiCert – OpenSSL Certificate Conversion

Posted on March 9, 2017

I work with digicert® to get certificates. The way we get certificates sometimes requires me to convert the certificates, below is the process I use to get the formats for what I may need. This script assumes you have a directory with only the .csr file and the .zip file…

Read More

Mac OSX Terminal – Wi-Fi & Ethernet Switch

Posted on April 9, 2018

Sometimes you need to turn off Wi-Fi and turn on Ethernet and vice-versa NOTE: Important to know what your configuration is. sudo ifconfig en6 up && sudo ifconfig en0 down sudo ifconfig en6 down && sudo ifconfig en0 up All information on this site is shared with the intention to…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes