在我的一些程序中,我按照预期进行了 30 天的轮换,其中包含几个月的多个条目,但只有 30 个日志文件。在其他程序中,我只有一天的日志文件,但总共仍然只有 30 个日志文件。我想要的只是过去 30 天的日志文件条目以及 30 个日志文件。我想我不知道我错过了什么。
昨天,当程序启动备份时,我的一个日志文件被覆盖,因此我丢失了可以告诉我发生了什么情况的数据。那么我的第二个问题是,归档是否只是删除不符合模式的文件,还是实际上获取日志文件并将它们放在某个地方?归档到底是什么?这是我的 nlog.config:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<variable name="LogDir" value="${specialfolder:folder=MyDocuments}/MyApp/Log"/>
<variable name="LogDay" value="${date:format=dd}"/>
<targets async="true">
<!-- add your targets here -->
<target name="LogTarget1"
xsi:type="File"
fileName="${LogDay}.log"
encoding="utf-8"
maxArchiveFiles="30"
archiveNumbering="Sequence"
archiveAboveSize="52428800"
archiveFileName="${LogDay}.{#######}.log"
layout="${date:format=MM/dd/yyyy HH\:mm\:ss}|${level:uppercase=true}|${message}" />
</targets>
<rules>
<!-- add your logging rules here -->
<logger name="*" minlevel="Trace" writeTo="LogTarget1" />
</rules>
</nlog>
Run Code Online (Sandbox Code Playgroud) 我遇到了麻烦,所以我进入了注册表并删除了rabbitmq的服务条目.现在,当我尝试重新安装它说它已经存在但它没有启动(因为我删除它)我可以做sc delete rabbitmq.如何完全删除所有痕迹并从头开始重新安装?我猜它存在于某个地方,注册表项已经全部消失了,安装程序说我们只是在我做的时候更新它rabbitmq-service install.我试过
rabbitmq-service remove但它说它不存在.
使用WPF和VB.net,我想用当前日期和时间更新文本块中的文本框.我使用计时器,它似乎正在触发,并将对象属性设置为"现在".我正在使用iNotifyPropertyChanged.
我得到的只是一个没有数据的空文本框.你能帮我吗?也许我的背景是关闭的?
XAML
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBlock DataContext="oTime">
<TextBox x:Name="myTextBox"
Width="200" Height="50" Foreground="Black"
Text="{Binding Path=oTime.TimeUpdate}"></TextBox>
</TextBlock>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
VB代码
Imports System.ComponentModel
Imports System.Windows.Threading
Class MainWindow
Public oTime As TimeUpdate = New TimeUpdate
Private dpTimer As DispatcherTimer
Private Sub TextBlock_SourceUpdated(ByVal sender As System.Object, ByVal e As System.Windows.Data.DataTransferEventArgs)
End Sub
Private Sub MainWindow_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
dpTimer = New DispatcherTimer
dpTimer.Interval = TimeSpan.FromMilliseconds(1000)
AddHandler dpTimer.Tick, AddressOf TickMe
dpTimer.Start()
End Sub
Private …Run Code Online (Sandbox Code Playgroud)