This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AppLogger.Logger.SuppressErrors = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public AppLogger(string loggerName) | |
{ | |
try | |
{ | |
// Initiate logger object | |
this.Log = LogManager.GetLogger(loggerName); | |
#if DEBUG | |
// Create a log file in the Temp folder | |
string logFilePath = Path.GetTempFileName(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static AppLogger Logger | |
{ | |
get | |
{ | |
// if logger is null, create an instance. | |
if (AppLogger._Logger == null) | |
{ | |
try | |
{ | |
AppLogger._Logger = new AppLogger("AppLogger"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AppLogger.Logger.Debug("This is a message."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<file value="==LOG_FILE_PATH==" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<conversionPattern value='* %date – [%thread] – %-5level – %logger – %message%newline' /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clear-Host | |
# Decleare variable to hold the service name | |
$serviceName = "MSSQL`$SQLEXPRESS" | |
# Where the log file will be stored | |
$logHome = "D:\Amr\Backup\BackupLogs\" | |
# Get timestamp | |
$timeStamp = Get-Date -Format "yyyy-MM-dd HH-mm-ss" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-Date -format "yyyy-MM-dd HH-mm-ss" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem | out-file "D:\MyOutputFile.txt" -Append -Force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Run-SyncToy ($backupPlan) | |
{ | |
$Exe = "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" | |
& $Exe -R $backupPlan | |
} |