不同的日志文件以及如何附加spring logger

时间:2019-06-22 23:36:20

标签: java log4j

在一个项目中,有几个与main相关的类,并希望为每个main类创建不同的日志文件。

下面尝试使用log4j创建两个不同的日志文件,但希望在日志文件中也包含与spring相关的日志记录。

Spring日志记录位于根记录程序文件MyApp.log中。如何在OrdersLoad.log和EmployeesLoad.log中记录这些记录

请对此提供帮助。

Project1

MainClass1 ------ MainClass1,Subclass11,Subclass12的日志文件1

MainClass2 ------ MainClass2,Subclass21,Subclas22的日志文件2

这是log4j属性

Sub helpMePlease()   
      Dim myfile As String
      Dim mypath As String 
      Dim mycount As Integer 
      Dim mydate As String            

      mydate = Format(Now(), "MM-DD-YYYY") 
      mypath = "C:\Users\Robert\Colors\

      'do some code here, like opening a workbook and translating data, etc.

      'now, to save the opened workbook I came up with the below code    
      'it says increase my file name by 1 unless file name does not exist within my path

    Do
          mycount = mycount + 1
          myfile = mypath & "Blue " & mydate & " #" & mycount & ".xlsx"     
    Loop Until Dir(myfile) = ""          

    ActiveWorkbook.SaveAs Filename:=myfile

End Sub

0 个答案:

没有答案