| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- 분노
- build
- Linux
- JQuery
- Anaconda
- checkbox
- 가상환경
- LOG
- 원한
- STS
- ORA-28002
- error
- Custom
- DataTables
- HMI
- 맥코트
- 리눅스
- 말라키
- 파이썬
- Eclipse
- SCADA
- geckodriver
- pythoncom37.dll
- 명령어
- Python
Archives
- Today
- Total
2010년 5월 1일, 2막
[C#] log 저장 본문
private void SaveLog(string log)
{
// Log 저장될 경로
m_logDicPath = string.Format("{0}\\log", Application.StartupPath);
// Log 파일 이름 (로그가 생성된 일자를 기준으로 생성되게)
m_logFilePath = string.Format("{0}\\{1}_log.txt", m_logDicPath, DateTime.Today.ToShortDateString());
// 기록될 Message를 만든다.
string msg = string.Format("[{0}] {1}{2}", DateTime.Now.ToString("u"), log, Environment.NewLine);
// Log를 기록할 폴더 유무를 확인후 생성한다
if (!Directory.Exists(m_logDicPath))
{
Directory.CreateDirectory(m_logDicPath);
}
// Log 내용을 text 파일에 기록한다.
File.AppendAllText(m_logFilePath, msg);
}
'Computer' 카테고리의 다른 글
| [ORACLE] ORA-28001: the password has expired 해결법 (0) | 2013.08.08 |
|---|---|
| [JSP] Java 파일 컴파일 방법 (0) | 2013.08.06 |
| [C#] assigning Null value to datetime in C# (0) | 2013.05.09 |
| [C#] BackgroundWorker (0) | 2013.04.26 |
| [C#] what event catches a change of value in a combobox in a DataGridViewCell? (0) | 2013.04.21 |