Changeset 8901


Ignore:
Timestamp:
Sep 30, 2020, 4:38:12 PM (16 months ago)
Author:
kopal
Message:

CrypToolStoreBuildServer:

  • added stack traces to exception logging
  • changed String.format to string.format in all classes
Location:
trunk/LibSource/CrypToolStoreLib/CrypToolStoreBuildSystem
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LibSource/CrypToolStoreLib/CrypToolStoreBuildSystem/BuildLogger.cs

    r7790 r8901  
    1616using CrypToolStoreLib.Tools;
    1717using System;
    18 using System.Collections.Generic;
    19 using System.Linq;
    2018using System.Text;
    21 using System.Threading.Tasks;
    2219
    2320namespace CrypToolStoreBuildSystem
     
    5047                    //here, write everything to the LogStringBuilder
    5148                    case Logtype.Debug:
    52                         entry = String.Format("{0} {1} {2}: {3}", DateTime.Now, "Debug", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", message);
    53                         LogStringBuilder.AppendLine(entry);
     49                        entry = string.Format("{0} {1} {2}: {3}", DateTime.Now, "Debug", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", message);                       
    5450                        break;
    5551                    case Logtype.Info:
    56                         entry = String.Format("{0} {1} {2}: {3}", DateTime.Now, "Info", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", message);
    57                         LogStringBuilder.AppendLine(entry);
     52                        entry = string.Format("{0} {1} {2}: {3}", DateTime.Now, "Info", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", message);
    5853                        break;
    5954                    case Logtype.Warning:
    60                         entry = String.Format("{0} {1} {2}: {3}", DateTime.Now, "Warning", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", message);
    61                         LogStringBuilder.AppendLine(entry);
     55                        entry = string.Format("{0} {1} {2}: {3}", DateTime.Now, "Warning", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", message);
    6256                        break;
    6357                    case Logtype.Error:
    64                         entry = String.Format("{0} {1} {2}: {3}", DateTime.Now, "Error", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", message);
    65                         LogStringBuilder.AppendLine(entry);
     58                        entry = string.Format("{0} {1} {2}: {3}", DateTime.Now, "Error", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", message);
    6659                        break;
    6760                    default:
    68                         entry = String.Format("{0} {1} {2}: {3}", DateTime.Now, "Unknown", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", message);
    69                         LogStringBuilder.AppendLine(entry);
     61                        entry = string.Format("{0} {1} {2}: {3}", DateTime.Now, "Unknown", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", message);
    7062                        break;
    7163                }
     64                LogStringBuilder.AppendLine(entry);
    7265                //finally, forward the log to the actual logger
    7366                Logger.LogText(entry, whoLoggs, logtype);
    7467            }
     68        }
     69
     70        /// <summary>
     71        /// Logs an exception
     72        /// </summary>
     73        /// <param name="ex"></param>
     74        /// <param name="whoLoggs"></param>
     75        /// <param name="logtype"></param>
     76        public void LogException(Exception ex, object whoLoggs, Logtype logtype)
     77        {
     78            string entry;
     79            switch (logtype)
     80            {
     81                //here, write everything to the LogStringBuilder
     82                case Logtype.Debug:
     83                    entry = string.Format("{0} {1} {2}: Stacktrace: {3}", DateTime.Now, "Debug", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", ex.StackTrace);
     84                    LogStringBuilder.AppendLine(entry);
     85                    break;
     86                case Logtype.Info:
     87                    entry = string.Format("{0} {1} {2}: Stacktrace: {3}", DateTime.Now, "Info", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", ex.StackTrace);
     88                    LogStringBuilder.AppendLine(entry);
     89                    break;
     90                case Logtype.Warning:
     91                    entry = string.Format("{0} {1} {2}: Stacktrace: {3}", DateTime.Now, "Warning", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", ex.StackTrace);
     92                    LogStringBuilder.AppendLine(entry);
     93                    break;
     94                case Logtype.Error:
     95                    entry = string.Format("{0} {1} {2}: Stacktrace: {3}", DateTime.Now, "Error", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", ex.StackTrace);
     96                    LogStringBuilder.AppendLine(entry);
     97                    break;
     98                default:
     99                    entry = string.Format("{0} {1} {2}: Stacktrace: {3}", DateTime.Now, "Unknown", whoLoggs != null ? whoLoggs.GetType().FullName + "-" + whoLoggs.GetHashCode() : "null", ex.StackTrace);
     100                    LogStringBuilder.AppendLine(entry);
     101                    break;
     102            }           
     103            LogStringBuilder.AppendLine(entry);
     104            //finally, forward the log to the actual logger
     105            Logger.LogException(ex, whoLoggs, logtype);
    75106        }
    76107
  • trunk/LibSource/CrypToolStoreLib/CrypToolStoreBuildSystem/BuildWorker.cs

    r8686 r8901  
    148148        public void BuildWorkerTaskMethod()
    149149        {
    150             Logger.LogText(String.Format("(General) Started build of source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     150            Logger.LogText(string.Format("(General) Started build of source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    151151            bool buildError = true; //set build error to true; at the end, if everything is ok, error is set to false
    152152                                    //this is needed for the update of the Source's state in the CrypToolStoreDatabase
     
    322322                //if the build process reaches this point, we have no build error
    323323                buildError = false;
    324                 Logger.LogText(String.Format("(General) Finished build of source-{0}-{1} without errors", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     324                Logger.LogText(string.Format("(General) Finished build of source-{0}-{1} without errors", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    325325            }
    326326            catch (Exception ex)
    327327            {
    328                 Logger.LogText(String.Format("(General) Exception occured during build of source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, ex.Message), this, Logtype.Error);
     328                Logger.LogText(string.Format("(General) Exception occured during build of source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, ex.Message), this, Logtype.Error);
     329                Logger.LogException(ex, this, Logtype.Error);
    329330            }
    330331            finally
     
    337338                catch (Exception ex)
    338339                {
    339                     Logger.LogText(String.Format("(General) Exception occured during cleanup of source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, ex.Message), this, Logtype.Error);
     340                    Logger.LogText(string.Format("(General) Exception occured during cleanup of source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, ex.Message), this, Logtype.Error);
     341                    Logger.LogException(ex, this, Logtype.Error);
    340342                }
    341343
     
    348350                catch (Exception ex)
    349351                {
    350                     Logger.LogText(String.Format("(General) Exception occured during SetFinalBuildStateAndUploadBuildlog of source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, ex.Message), this, Logtype.Error);
     352                    Logger.LogText(string.Format("(General) Exception occured during SetFinalBuildStateAndUploadBuildlog of source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, ex.Message), this, Logtype.Error);
     353                    Logger.LogException(ex, this, Logtype.Error);
    351354                }
    352355                IsRunning = false;
     
    359362                catch (Exception ex)
    360363                {
    361                     Logger.LogText(String.Format("(General) Exception occured during SendEmailToDeveloper of source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, ex.Message), this, Logtype.Error);
     364                    Logger.LogText(string.Format("(General) Exception occured during SendEmailToDeveloper of source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, ex.Message), this, Logtype.Error);
     365                    Logger.LogException(ex, this, Logtype.Error);
    362366                }
    363367            }
     
    369373        private bool SetToBuildingState()
    370374        {
    371             Logger.LogText(String.Format("(Buildstep 0) Set source-{0}-{1} to state: {2}", Source.PluginId, Source.PluginVersion, BuildState.BUILDING.ToString()), this, Logtype.Info);
     375            Logger.LogText(string.Format("(Buildstep 0) Set source-{0}-{1} to state: {2}", Source.PluginId, Source.PluginVersion, BuildState.BUILDING.ToString()), this, Logtype.Info);
    372376
    373377            CrypToolStoreClient client = new CrypToolStoreClient();
     
    384388                if (!result.Success)
    385389                {
    386                     Logger.LogText(String.Format("(Buildstep 0) Could not get source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, result.Message), this, Logtype.Error);
     390                    Logger.LogText(string.Format("(Buildstep 0) Could not get source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, result.Message), this, Logtype.Error);
    387391                    return false;
    388392                }
     
    390394                //update that source to building state
    391395                source.BuildState = BuildState.BUILDING.ToString();
    392                 source.BuildLog = String.Format("Buildserver started build worker at {0}", DateTime.Now);
     396                source.BuildLog = string.Format("Buildserver started build worker at {0}", DateTime.Now);
    393397                result = client.UpdateSource(source);
    394398                if (!result.Success)
    395399                {
    396                     Logger.LogText(String.Format("(Buildstep 0) Could not set source-{0}-{1} to state {2}: {3}", Source.PluginId, Source.PluginVersion, BuildState.BUILDING, result.Message), this, Logtype.Error);
     400                    Logger.LogText(string.Format("(Buildstep 0) Could not set source-{0}-{1} to state {2}: {3}", Source.PluginId, Source.PluginVersion, BuildState.BUILDING, result.Message), this, Logtype.Error);
    397401                    return false;
    398402                }
    399403
    400                 Logger.LogText(String.Format("(Buildstep 0) Source-{0}-{1} is now in state: {2}", Source.PluginId, Source.PluginVersion, BuildState.BUILDING.ToString()), this, Logtype.Info);
     404                Logger.LogText(string.Format("(Buildstep 0) Source-{0}-{1} is now in state: {2}", Source.PluginId, Source.PluginVersion, BuildState.BUILDING.ToString()), this, Logtype.Info);
    401405                return true;
    402406            }
     
    419423                {
    420424                    Directory.CreateDirectory(BUILD_FOLDER);
    421                     Logger.LogText(String.Format("(Buildstep 1) Created build folder: {0}", BUILD_FOLDER), this, Logtype.Info);                   
     425                    Logger.LogText(string.Format("(Buildstep 1) Created build folder: {0}", BUILD_FOLDER), this, Logtype.Info);                   
    422426                }
    423427            }
     
    428432            {               
    429433                Directory.CreateDirectory(buildfoldername);
    430                 Logger.LogText(String.Format("(Buildstep 1) Created build folder for source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, buildfoldername), this, Logtype.Info);
     434                Logger.LogText(string.Format("(Buildstep 1) Created build folder for source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, buildfoldername), this, Logtype.Info);
    431435                return true;
    432436            }
    433437            else
    434438            {
    435                 Logger.LogText(String.Format("(Buildstep 1) Folder for source-{0}-{1} already exists. Maybe because of faulty previous build. Abort now", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
     439                Logger.LogText(string.Format("(Buildstep 1) Folder for source-{0}-{1} already exists. Maybe because of faulty previous build. Abort now", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
    436440                return false;
    437441            }
     
    456460            //1. create plugin folder
    457461            Directory.CreateDirectory(buildfoldername + @"\plugin");
    458             Logger.LogText(String.Format("(Buildstep 2) Created plugin folder for source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     462            Logger.LogText(string.Format("(Buildstep 2) Created plugin folder for source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    459463
    460464            //2. create build_output folder
    461465            Directory.CreateDirectory(buildfoldername + @"\build_output");
    462             Logger.LogText(String.Format("(Buildstep 2) Created build_output folder for source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     466            Logger.LogText(string.Format("(Buildstep 2) Created build_output folder for source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    463467
    464468            //3. create build_plugin.xml
     
    475479                }
    476480            }
    477             Logger.LogText(String.Format("(Buildstep 2) Created build_plugin.xml for source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     481            Logger.LogText(string.Format("(Buildstep 2) Created build_plugin.xml for source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    478482            return true;
    479483        }
     
    485489        private bool DownloadZipFile()
    486490        {
    487             Logger.LogText(String.Format("(Buildstep 3) Start downloading source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     491            Logger.LogText(string.Format("(Buildstep 3) Start downloading source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    488492            CrypToolStoreClient client = new CrypToolStoreClient();
    489493            client.ServerCertificate = ServerCertificate;
     
    497501            DateTime startTime = DateTime.Now;
    498502            bool stop = false;
    499             DataModificationOrRequestResult result = client.DownloadSourceZipFile(Source, String.Format(buildfoldername + @"\plugin\source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), ref stop);
     503            DataModificationOrRequestResult result = client.DownloadSourceZipFile(Source, string.Format(buildfoldername + @"\plugin\source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), ref stop);
    500504            client.Disconnect();
    501505
    502506            if (result.Success)
    503507            {
    504                 Logger.LogText(String.Format("(Buildstep 3) Downloaded source-{0}-{1}.zip in {2}", Source.PluginId, Source.PluginVersion, DateTime.Now.Subtract(startTime)), this, Logtype.Info);
     508                Logger.LogText(string.Format("(Buildstep 3) Downloaded source-{0}-{1}.zip in {2}", Source.PluginId, Source.PluginVersion, DateTime.Now.Subtract(startTime)), this, Logtype.Info);
    505509                return true;
    506510            }
    507511            else
    508512            {
    509                 Logger.LogText(String.Format("(Buildstep 3) Download of source-{0}-{1}.zip failed. Message was: {2}", Source.PluginId, Source.PluginVersion, result.Message), this, Logtype.Error);
     513                Logger.LogText(string.Format("(Buildstep 3) Download of source-{0}-{1}.zip failed. Message was: {2}", Source.PluginId, Source.PluginVersion, result.Message), this, Logtype.Error);
    510514                return false;
    511515            }           
     
    518522        private bool ExtractZipFile()
    519523        {
    520             Logger.LogText(String.Format("(Buildstep 4) Start extracting source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     524            Logger.LogText(string.Format("(Buildstep 4) Start extracting source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    521525            string buildfoldername = BUILD_FOLDER + @"\" + SOURCE_FILE_NAME + "-" + Source.PluginId + "-" + Source.PluginVersion;
    522             ZipFile.ExtractToDirectory(buildfoldername + String.Format(@"\plugin\source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), buildfoldername + @"\plugin\");
    523             File.Delete(buildfoldername + String.Format(@"\plugin\source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion));
    524             Logger.LogText(String.Format("(Buildstep 4) Finished extracting source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     526            ZipFile.ExtractToDirectory(buildfoldername + string.Format(@"\plugin\source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), buildfoldername + @"\plugin\");
     527            File.Delete(buildfoldername + string.Format(@"\plugin\source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion));
     528            Logger.LogText(string.Format("(Buildstep 4) Finished extracting source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    525529            return true;
    526530        }
     
    542546            if (counter == 0)
    543547            {
    544                 Logger.LogText(String.Format("(Buildstep 5) Source-{0}-{1} does not contain any csproj file", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
     548                Logger.LogText(string.Format("(Buildstep 5) Source-{0}-{1} does not contain any csproj file", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
    545549                return false;
    546550            }
    547551            if (counter > 1)
    548552            {
    549                 Logger.LogText(String.Format("(Buildstep 5) source-{0}-{1} contains more than one csproj file", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
    550             }
    551 
    552             Logger.LogText(String.Format("(Buildstep 5) Found csproj file in source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, CSProjFileName), this, Logtype.Info);
     553                Logger.LogText(string.Format("(Buildstep 5) source-{0}-{1} contains more than one csproj file", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
     554            }
     555
     556            Logger.LogText(string.Format("(Buildstep 5) Found csproj file in source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, CSProjFileName), this, Logtype.Info);
    553557            return true;
    554558        }
     
    759763            }           
    760764            csprojXDocument.Save(CSProjFileName,SaveOptions.OmitDuplicateNamespaces);
    761             Logger.LogText(String.Format("(Buildstep 6) Wrote changes to {0}", CSProjFileName), this, Logtype.Info);
     765            Logger.LogText(string.Format("(Buildstep 6) Wrote changes to {0}", CSProjFileName), this, Logtype.Info);
    762766
    763767            return true;
     
    790794        private bool BuildPlugin()
    791795        {
    792             Logger.LogText(String.Format("(Buildstep 8) Starting actual build of source-{0}-{1} using msbuild.exe", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     796            Logger.LogText(string.Format("(Buildstep 8) Starting actual build of source-{0}-{1} using msbuild.exe", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    793797            string buildfoldername = BUILD_FOLDER + @"\" + SOURCE_FILE_NAME + "-" + Source.PluginId + "-" + Source.PluginVersion;
    794798
    795799            ProcessStartInfo info = new ProcessStartInfo("msbuild.exe");
    796             info.Arguments = buildfoldername + String.Format("\\build_plugin.xml /p:Platform={0} /p:Configuration=Release /p:CertificatePfxFile=\"{1}\" /p:CertificatePassword=\"{2}\"", BUILD_TARGET, SigningCertificatePfxFile, SigningCertificatePassword);
     800            info.Arguments = buildfoldername + string.Format("\\build_plugin.xml /p:Platform={0} /p:Configuration=Release /p:CertificatePfxFile=\"{1}\" /p:CertificatePassword=\"{2}\"", BUILD_TARGET, SigningCertificatePfxFile, SigningCertificatePassword);
    797801            info.CreateNoWindow = false;
    798802            info.UseShellExecute = false;
     
    809813            process.WaitForExit();
    810814
    811             Logger.LogText(String.Format("(Buildstep 8) Output of msbuild for source-{0}-{1}:\r\n{2}", Source.PluginId, Source.PluginVersion, msbuild_Log.ToString()), this, process.ExitCode == 0 ? Logtype.Info : Logtype.Error);
     815            Logger.LogText(string.Format("(Buildstep 8) Output of msbuild for source-{0}-{1}:\r\n{2}", Source.PluginId, Source.PluginVersion, msbuild_Log.ToString()), this, process.ExitCode == 0 ? Logtype.Info : Logtype.Error);
    812816
    813817            if (process.ExitCode != 0)
    814818            {
    815                 Logger.LogText(String.Format("(Buildstep 8) Build of source-{0}-{1} failed", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
     819                Logger.LogText(string.Format("(Buildstep 8) Build of source-{0}-{1} failed", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
    816820                return false;
    817821            }
     
    861865            if (counter == 0)
    862866            {
    863                 Logger.LogText(String.Format("(Buildstep 9) Did not find any dll-file in build_output folder after building source-{0}-{1}. Abort now", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
     867                Logger.LogText(string.Format("(Buildstep 9) Did not find any dll-file in build_output folder after building source-{0}-{1}. Abort now", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
    864868                return false;
    865869            }
    866             Logger.LogText(String.Format("(Buildstep 9) Found {0} dll-file in build_output folder after building source-{1}-{2}", counter, Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     870            Logger.LogText(string.Format("(Buildstep 9) Found {0} dll-file in build_output folder after building source-{1}-{2}", counter, Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    867871            return true;
    868872        }
     
    890894
    891895            ProcessStartInfo info = new ProcessStartInfo("signtool.exe");
    892             info.Arguments = String.Format("sign /f {0} /p {1} /t {2} {3}", SigningCertificatePfxFile, SigningCertificatePassword, TIMESTAMP_SERVER, filenames.ToString());
     896            info.Arguments = string.Format("sign /f {0} /p {1} /t {2} {3}", SigningCertificatePfxFile, SigningCertificatePassword, TIMESTAMP_SERVER, filenames.ToString());
    893897            info.CreateNoWindow = false;
    894898            info.UseShellExecute = false;
     
    905909            process.WaitForExit();
    906910
    907             Logger.LogText(String.Format("(Buildstep 10) Output of signtool:\r\n{0}",signtool_Log.ToString()), this, process.ExitCode == 0 ? Logtype.Info : Logtype.Error);
     911            Logger.LogText(string.Format("(Buildstep 10) Output of signtool:\r\n{0}",signtool_Log.ToString()), this, process.ExitCode == 0 ? Logtype.Info : Logtype.Error);
    908912
    909913            if (process.ExitCode != 0)
     
    953957        private bool CreateMetaFile()
    954958        {
    955             Logger.LogText(String.Format("(Buildstep 11) Start creating pluginmetainfo.xml for assembly-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     959            Logger.LogText(string.Format("(Buildstep 11) Start creating pluginmetainfo.xml for assembly-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    956960
    957961            string metafilename = BUILD_FOLDER + @"\" + SOURCE_FILE_NAME + "-" + Source.PluginId + "-" + Source.PluginVersion + @"\build_output\pluginmetainfo.xml";
     
    985989            }
    986990
    987             Logger.LogText(String.Format("(Buildstep 11) Created pluginmetainfo.xml for assembly-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     991            Logger.LogText(string.Format("(Buildstep 11) Created pluginmetainfo.xml for assembly-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    988992            return true;
    989993        }
     
    9961000        private bool CreateAssemblyZip()
    9971001        {           
    998             Logger.LogText(String.Format("(Buildstep 12) Start creating assembly-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     1002            Logger.LogText(string.Format("(Buildstep 12) Start creating assembly-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    9991003
    10001004            //remove pdb-files since these are not needed in the zip file
     
    10091013            ZipFile.CreateFromDirectory(BUILD_FOLDER + @"\" + SOURCE_FILE_NAME + "-" + Source.PluginId + "-" + Source.PluginVersion + @"\" + "build_output\\", zipfile_path_and_name, CompressionLevel.Optimal, false);
    10101014
    1011             Logger.LogText(String.Format("(Buildstep 12) Created assembly-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     1015            Logger.LogText(string.Format("(Buildstep 12) Created assembly-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    10121016            return true;
    10131017        }
     
    10191023        private bool UploadAssemblyZip()
    10201024        {
    1021             Logger.LogText(String.Format("(Buildstep 13) Start uploading assembly zipfile for source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     1025            Logger.LogText(string.Format("(Buildstep 13) Start uploading assembly zipfile for source-{0}-{1}.zip", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    10221026            CrypToolStoreClient client = new CrypToolStoreClient();
    10231027            client.ServerCertificate = ServerCertificate;
     
    10371041            if (result.Success)
    10381042            {
    1039                 Logger.LogText(String.Format("(Buildstep 13) Uploaded assembly zipfile of source-{0}-{1}.zip in {2}", Source.PluginId, Source.PluginVersion, DateTime.Now.Subtract(startTime)), this, Logtype.Info);
     1043                Logger.LogText(string.Format("(Buildstep 13) Uploaded assembly zipfile of source-{0}-{1}.zip in {2}", Source.PluginId, Source.PluginVersion, DateTime.Now.Subtract(startTime)), this, Logtype.Info);
    10401044                return true;
    10411045            }
    10421046            else
    10431047            {
    1044                 Logger.LogText(String.Format("(Buildstep 13) Upload of assembly zipfile of source-{0}-{1}.zip failed. Message was: {2}", Source.PluginId, Source.PluginVersion, result.Message), this, Logtype.Error);
     1048                Logger.LogText(string.Format("(Buildstep 13) Upload of assembly zipfile of source-{0}-{1}.zip failed. Message was: {2}", Source.PluginId, Source.PluginVersion, result.Message), this, Logtype.Error);
    10451049                return false;
    10461050            }           
     
    10561060            {
    10571061                Directory.Delete(buildfoldername, true);
    1058                 Logger.LogText(String.Format("(Buildstep 14) Deleted build folder for source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, buildfoldername), this, Logtype.Info);               
     1062                Logger.LogText(string.Format("(Buildstep 14) Deleted build folder for source-{0}-{1}: {2}", Source.PluginId, Source.PluginVersion, buildfoldername), this, Logtype.Info);               
    10591063            }           
    10601064        }
     
    10661070        private void SetFinalBuildStateAndUploadBuildlog(bool buildError)
    10671071        {
    1068             Logger.LogText(String.Format("(Buildstep 15) Set final build state of source-{0}-{1} and upload build log", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     1072            Logger.LogText(string.Format("(Buildstep 15) Set final build state of source-{0}-{1} and upload build log", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    10691073            CrypToolStoreClient client = new CrypToolStoreClient();
    10701074            client.ServerCertificate = ServerCertificate;
     
    10791083            if (buildError)
    10801084            {
    1081                 Logger.LogText(String.Format("(Buildstep 15) Set state of source-{0}-{1} to ERROR", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
     1085                Logger.LogText(string.Format("(Buildstep 15) Set state of source-{0}-{1} to ERROR", Source.PluginId, Source.PluginVersion), this, Logtype.Error);
    10821086                source.BuildState = BuildState.ERROR.ToString();
    10831087            }
     
    10871091                source.BuildVersion++;
    10881092
    1089                 Logger.LogText(String.Format("(Buildstep 15) Set state of source-{0}-{1} to SUCCESS", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     1093                Logger.LogText(string.Format("(Buildstep 15) Set state of source-{0}-{1} to SUCCESS", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    10901094                source.BuildState = BuildState.SUCCESS.ToString();
    10911095            }
     
    11001104            if (result.Success)
    11011105            {
    1102                 Logger.LogText(String.Format("(Buildstep 15) Uploaded build log of source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     1106                Logger.LogText(string.Format("(Buildstep 15) Uploaded build log of source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    11031107            }
    11041108            else
    11051109            {
    1106                 Logger.LogText(String.Format("(Buildstep 15) Setting final build state of source-{0}-{1} and upload build log failed. Message was: {2}", Source.PluginId, Source.PluginVersion, result.Message), this, Logtype.Error);
     1110                Logger.LogText(string.Format("(Buildstep 15) Setting final build state of source-{0}-{1} and upload build log failed. Message was: {2}", Source.PluginId, Source.PluginVersion, result.Message), this, Logtype.Error);
    11071111            }           
    11081112        }
     
    11131117        private void SendEmailToDeveloper(bool buildError)
    11141118        {
    1115             Logger.LogText(String.Format("(Buildstep 16) Send email to developer of source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     1119            Logger.LogText(string.Format("(Buildstep 16) Send email to developer of source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    11161120            //Get email of developer
    11171121            CrypToolStoreClient client = new CrypToolStoreClient();
     
    11281132            if (String.IsNullOrEmpty(developer.Email) || !IsValidEmail(developer.Email))
    11291133            {
    1130                 Logger.LogText(String.Format("(Buildstep 16) Cannot send build email to {0} since we have no valid email address (={1}) of this developer!", plugin.Username, developer.Email), this, Logtype.Warning);
     1134                Logger.LogText(string.Format("(Buildstep 16) Cannot send build email to {0} since we have no valid email address (={1}) of this developer!", plugin.Username, developer.Email), this, Logtype.Warning);
    11311135                return;
    11321136            }
     
    11411145            if (buildError)
    11421146            {
    1143                 subject = String.Format("[CrypToolStore Build System] Build Error occured while building your Source-{0}-{1}", Source.PluginId, Source.PluginVersion);
    1144                 bodyBuilder.AppendLine(String.Format("Dear {0},", plugin.Username));
     1147                subject = string.Format("[CrypToolStore Build System] Build Error occured while building your Source-{0}-{1}", Source.PluginId, Source.PluginVersion);
     1148                bodyBuilder.AppendLine(string.Format("Dear {0},", plugin.Username));
    11451149                bodyBuilder.AppendLine();
    1146                 bodyBuilder.AppendLine(String.Format("The build of Source-{0}-{1} was erroneous.", Source.PluginId, Source.PluginVersion));
     1150                bodyBuilder.AppendLine(string.Format("The build of Source-{0}-{1} was erroneous.", Source.PluginId, Source.PluginVersion));
    11471151                bodyBuilder.AppendLine("Please see attached buildlog.txt for additional information.");
    11481152                bodyBuilder.AppendLine();
     
    11521156            else
    11531157            {
    1154                 subject = String.Format("[CrypToolStore Build System] Build of your Source-{0}-{1} successfully finished", Source.PluginId, Source.PluginVersion);
    1155                 bodyBuilder.AppendLine(String.Format("Dear {0},", plugin.Username));
     1158                subject = string.Format("[CrypToolStore Build System] Build of your Source-{0}-{1} successfully finished", Source.PluginId, Source.PluginVersion);
     1159                bodyBuilder.AppendLine(string.Format("Dear {0},", plugin.Username));
    11561160                bodyBuilder.AppendLine();
    1157                 bodyBuilder.AppendLine(String.Format("The build of Source-{0}-{1} was a success.", Source.PluginId, Source.PluginVersion));
     1161                bodyBuilder.AppendLine(string.Format("The build of Source-{0}-{1} was a success.", Source.PluginId, Source.PluginVersion));
    11581162                bodyBuilder.AppendLine("Please see attached buildlog.txt for additional information.");
    11591163                bodyBuilder.AppendLine();
     
    11621166            }
    11631167            mailClient.SendEmail(from, to, subject, bodyBuilder.ToString(), "buildlog.txt", Logger.ToString());
    1164             Logger.LogText(String.Format("(Buildstep 16) Successfully sent email to developer of Source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
     1168            Logger.LogText(string.Format("(Buildstep 16) Successfully sent email to developer of Source-{0}-{1}", Source.PluginId, Source.PluginVersion), this, Logtype.Info);
    11651169        }
    11661170
  • trunk/LibSource/CrypToolStoreLib/CrypToolStoreBuildSystem/CrypToolStoreBuildServer.cs

    r7894 r8901  
    9898                catch (Exception ex)
    9999                {
    100                     Logger.LogText(String.Format("Exception occured in BuildServerLoop: {0}", ex.Message), this, Logtype.Error);
     100                    Logger.LogText(string.Format("Exception occured in BuildServerLoop: {0}", ex.Message), this, Logtype.Error);
     101                    Logger.LogException(ex, this, Logtype.Error);
    101102                }
    102103                finally
     
    149150                if (workers.Count < MAX_BUILD_WORKERS)
    150151                {
    151                     Logger.LogText(String.Format("Creating and starting worker to build source {0}-{1}", source.PluginId, source.PluginVersion), this, Logtype.Info);
     152                    Logger.LogText(string.Format("Creating and starting worker to build source {0}-{1}", source.PluginId, source.PluginVersion), this, Logtype.Info);
    152153                    BuildWorker worker = new BuildWorker(source, ServerCertificate);
    153154                    worker.SigningCertificatePfxFile = Config.GetConfigEntry("SigningCertificatePfxFile");
  • trunk/LibSource/CrypToolStoreLib/CrypToolStoreBuildSystem/MailClient.cs

    r8006 r8901  
    8787                        }
    8888                    }                                       
    89                     _logger.LogText(String.Format("Successfully sent email from {0} to {1}", from, to), this, Logtype.Info);
     89                    _logger.LogText(string.Format("Successfully sent email from {0} to {1}", from, to), this, Logtype.Info);
    9090                    return true;
    9191                }
    9292                catch (Exception ex)
    9393                {
    94                     _logger.LogText(String.Format("Exception occured during sending of build message: {0}",ex.Message), this, Logtype.Error);
     94                    _logger.LogText(string.Format("Exception occured during sending of build message: {0}",ex.Message), this, Logtype.Error);
    9595                    return false;
    9696                }
  • trunk/LibSource/CrypToolStoreLib/CrypToolStoreBuildSystem/Program.cs

    r7879 r8901  
    3737            catch (Exception ex)
    3838            {
    39                 Logger.GetLogger().LogText(String.Format("Exception while loading server certificate", ex.Message), null, Logtype.Error);
     39                Logger.GetLogger().LogText(string.Format("Exception while loading server certificate", ex.Message), null, Logtype.Error);
    4040                return;
    4141            }
Note: See TracChangeset for help on using the changeset viewer.