
Logback 提供两种类型的过滤器,常规过滤器和turbo过滤器。本例讲述基于常规过滤器的自定义实现。
常规的logback-classic过滤器扩展了 Filter 抽象类,它基本上由一个 decide() 以 ILoggingEvent 实例作为参数的方法组成 。
过滤器基于三元逻辑。 decide(ILoggingEvent event) 按顺序调用每个过滤器的方法。此方法返回的一个 FilterReply 枚举值,即 DENY 、 NEUTRAL 或 ACCEPT 。
在 logback 中,可以将过滤器添加到 Appender 实例中。通过向 appender 添加一个或多个过滤器,可以按任意条件过滤事件。
创建自己的过滤器很简单。所要做的就是扩展 Filter 抽象类并实现该 decide() 方法。
下面显示的 SampleFilter 类提供了一个示例。其 decide 方法返回 ACCEPT 以记录其消息字段中包含字符串 “sample” 的事件。对于其他事件,返回值 NEUTRAL。
接下来显示的配置文件将过滤器 SampleFilter 附加到 ConsoleAppender。
如果想设置过滤器的属性或子组件也很容易。在过滤器类中添加相应的setter方法后,在属性命名的xml元素中指定属性的值,并将其嵌套在 <filter> 元素中。
如将 SampleFilter 中的用于判断的字符串 "sample" 字符提取到配置文件中:
官方文档 - Filters
额,我上传不了文件只好全复制过来了,我的是这样的,希望能有所帮助
[Display]
fShadowBiasScale=03000
fInteriorShadowDistance=30000000
fShadowDistance=25000000
iBlurDeferredShadowMask=1
bFloatPointRenderTarget=1
iShadowMaskQuarter=4
iShadowMapResolution=1024
bFXAAEnabled=1
iMaxAnisotropy=1
fGamma=10000
iShadowFilter=3
fDecalLOD2=15000000
fDecalLOD1=10000000
fSpecularLODStartFade=5000000
fShadowLODStartFade=2000000
fLightLODStartFade=10000000
iTexMipMapMinimum=0
iTexMipMapSkip=0
bTransparencyMultisampling=0
iWaterMultiSamples=0
iMultiSample=4
iShadowMode=3
bTreesReceiveShadows=0
bDrawLandShadows=0
bDrawShadows=1
bFull Screen=1
iSize H=720
iSize W=1280
fLeafAnimDampenDistEnd=46000000
fLeafAnimDampenDistStart=36000000
fTreesMidLODSwitchDist=36000000
fMeshLODFadePercentDefault=12000
fMeshLODFadeBoundDefault=2560000
fMeshLODLevel2FadeTreeDistance=20480000
fMeshLODLevel1FadeTreeDistance=28440000
fMeshLODLevel2FadeDist=30720000
fMeshLODLevel1FadeDist=40960000
iScreenShotIndex=0
bShadowMaskZPrepass=0
bMainZPrepass=0
iMaxSkinDecalsPerFrame=3
iMaxDecalsPerFrame=10
sD3DDevice="Intel(R) HD Graphics 4000"
iAdapter=0
iPresentInterval=0
bShadowsOnGrass=1
bDeferredShadows=1
[Imagespace]
bDoDepthOfField=0
iRadialBlurLevel=0
[Grass]
b30GrassVS=0
fGrassStartFadeDistance=00000
fGrassMaxStartFadeDistance=70000000
fGrassMinStartFadeDistance=4000000
[Water]
iWaterReflectHeight=512
iWaterReflectWidth=512
bUseWaterDisplacements=1
bUseWaterRefractions=1
bUseWaterReflections=1
bUseWaterDepth=1
[MAIN]
fSkyCellRefFadeDistance=1500000000
bGamepadEnable=1
bCrosshairEnabled=1
fHUDOpacity=10000
bSaveOnPause=1
bSaveOnTravel=1
bSaveOnWait=1
bSaveOnRest=1
[GamePlay]
bShowFloatingQuestMarkers=1
bShowQuestMarkers=1
iDifficulty=0
[Interface]
bDialogueSubtitles=1
bGeneralSubtitles=1
bShowCompass=1
fMouseCursorSpeed=10000
[Controls]
fMouseHeadingSensitivity=00100
fGamepadHeadingSensitivity=19000
bAlwaysRunByDefault=1
bInvertYValues=0
bGamePadRumble=1
bUseKinect=0
[Particles]
iMaxDesired=750
[SaveGame]
fAutosaveEveryXMins=150000
[AudioMenu]
fAudioMasterVolume=10000
fVal7=10000
uID7=0
fVal6=10000
uID6=0
fVal5=10000
uID5=0
fVal4=10000
uID4=0
fVal3=10000
uID3=466532
fVal2=10000
uID2=554685
fVal1=10000
uID1=1007612
fVal0=10000
uID0=94881
[Clouds]
fCloudLevel2Distance=2621440000
fCloudLevel1Distance=327680000
fCloudLevel0Distance=163840000
fCloudNearFadeDistance=90000000
[General]
iStoryManagerLoggingEvent=-1
bEnableStoryManagerLogging=0
[TerrainManager]
fTreeLoadDistance=125000000
fBlockMaximumDistance=750000000
fBlockLevel1Distance=250000000
fBlockLevel0Distance=150000000
fSplitDistanceMult=04000
bShowLODInEditor=0
[Trees]
bRenderSkinnedTrees=1
uiMaxSkinnedTreesToRender=40
[Decals]
uMaxDecals=0
bDecals=0
bSkinnedDecals=0
uMaxSkinDecals=0
uMaxSkinDecalsPerActor=0
[LOD]
fLODFadeOutMultSkyCell=10000
fLODFadeOutMultObjects=25000
fLODFadeOutMultItems=10000
fLODFadeOutMultActors=25000
[BlurShaderHDR]
bDoHighDynamicRange=0
[BlurShader]
bUseBlurShader=0
[Launcher]
bShowAllResolutions=0
uLastAspectRatio=3
bEnableFileSelection=1
[Display]
sD3DDevice="Intel(R) HD Graphics 4000"
iTexMipMapSkip=1
bFXAAEnabled=0
fMeshLODLevel2FadeDist=30720000
fMeshLODLevel1FadeDist=40960000
fSpecularLODStartFade=2000000
fLightLODStartFade=2000000
fTreesMidLODSwitchDist=36000000
iShadowMapResolution=512
fShadowBiasScale=05000
iShadowMaskQuarter=3
iBlurDeferredShadowMask=0
fShadowDistance=20000000
iMaxDecalsPerFrame=0
iMaxSkinDecalsPerFrame=0
iAdapter=0
iSize W=1280
iSize H=720
iMultiSample=1
iMaxAnisotropy=1
iPresentInterval=0
bFull Screen=1
fGamma=10000
fInteriorShadowDistance=30000000
bFloatPointRenderTarget=1
fLeafAnimDampenDistEnd=46000000
fLeafAnimDampenDistStart=36000000
iShadowFilter=3
bShadowsOnGrass=1
fDecalLOD2=15000000
fDecalLOD1=10000000
fShadowLODStartFade=2000000
iTexMipMapMinimum=0
bTransparencyMultisampling=0
iWaterMultiSamples=0
bDeferredShadows=1
iShadowMode=3
bTreesReceiveShadows=0
bDrawLandShadows=0
bDrawShadows=1
fMeshLODFadePercentDefault=12000
fMeshLODFadeBoundDefault=2560000
fMeshLODLevel2FadeTreeDistance=20480000
fMeshLODLevel1FadeTreeDistance=28440000
iScreenShotIndex=24
bShadowMaskZPrepass=0
bMainZPrepass=0
等级低不能上传附件,你自己复制一下
[Display]
iTexMipMapSkip=1
bFXAAEnabled=0
fMeshLODLevel2FadeDist=30720000
fMeshLODLevel1FadeDist=40960000
fSpecularLODStartFade=2000000
fLightLODStartFade=2000000
fTreesMidLODSwitchDist=36000000
iShadowMapResolution=512
fShadowBiasScale=05000
iShadowMaskQuarter=4
iBlurDeferredShadowMask=0
fShadowDistance=20000000
iMaxDecalsPerFrame=0
iMaxSkinDecalsPerFrame=0
iAdapter=0
iSize W=1366
iSize H=768
iMultiSample=1
iMaxAnisotropy=1
iPresentInterval=1
bFull Screen=1
sD3DDevice="AMD Radeon(TM) R5 Graphics"
fInteriorShadowDistance=30000000
bFloatPointRenderTarget=1
fLeafAnimDampenDistEnd=46000000
fLeafAnimDampenDistStart=36000000
fGamma=11200
iShadowFilter=3
bShadowsOnGrass=1
fDecalLOD2=15000000
fDecalLOD1=10000000
fShadowLODStartFade=2000000
iTexMipMapMinimum=0
bTransparencyMultisampling=0
iWaterMultiSamples=0
bDeferredShadows=1
iShadowMode=3
bTreesReceiveShadows=0
bDrawLandShadows=0
bDrawShadows=1
fMeshLODFadePercentDefault=12000
fMeshLODFadeBoundDefault=2560000
fMeshLODLevel2FadeTreeDistance=20480000
fMeshLODLevel1FadeTreeDistance=28440000
iScreenShotIndex=0
bShadowMaskZPrepass=0
bMainZPrepass=0
[Imagespace]
iRadialBlurLevel=0
bDoDepthOfField=1
[LOD]
fLODFadeOutMultActors=25000
fLODFadeOutMultItems=10000
fLODFadeOutMultObjects=25000
fLODFadeOutMultSkyCell=10000
[Grass]
fGrassStartFadeDistance=00000
b30GrassVS=1
fGrassMaxStartFadeDistance=70000000
fGrassMinStartFadeDistance=4000000
[Decals]
bDecals=0
bSkinnedDecals=0
uMaxDecals=0
uMaxSkinDecals=0
uMaxSkinDecalsPerActor=0
[TerrainManager]
fTreeLoadDistance=125000000
fBlockMaximumDistance=750000000
fBlockLevel1Distance=250000000
fBlockLevel0Distance=150000000
fSplitDistanceMult=04000
bShowLODInEditor=0
[BlurShaderHDR]
bDoHighDynamicRange=0
[BlurShader]
bUseBlurShader=0
[Launcher]
bEnableFileSelection=1
bShowAllResolutions=1
uLastAspectRatio=3
[Water]
iWaterReflectHeight=512
iWaterReflectWidth=512
bUseWaterDisplacements=1
bUseWaterRefractions=1
bUseWaterReflections=1
bUseWaterDepth=1
[MAIN]
fSkyCellRefFadeDistance=1500000000
bGamepadEnable=0
bCrosshairEnabled=1
fHUDOpacity=10000
bSaveOnPause=1
bSaveOnTravel=1
bSaveOnWait=1
bSaveOnRest=1
[Interface]
fMouseCursorSpeed=10000
bDialogueSubtitles=1
bGeneralSubtitles=1
bShowCompass=1
[GamePlay]
bShowFloatingQuestMarkers=1
bShowQuestMarkers=1
iDifficulty=4
[Controls]
bUseKinect=0
fMouseHeadingSensitivity=00200
fGamepadHeadingSensitivity=19000
bAlwaysRunByDefault=1
bInvertYValues=0
bGamePadRumble=1
[Particles]
iMaxDesired=750
[SaveGame]
fAutosaveEveryXMins=150000
[AudioMenu]
fAudioMasterVolume=03500
fVal7=10000
uID7=0
fVal6=10000
uID6=0
fVal5=10000
uID5=0
fVal4=10000
uID4=0
fVal3=05000
uID3=466532
fVal2=08000
uID2=554685
fVal1=08000
uID1=1007612
fVal0=10000
uID0=94881
[Clouds]
fCloudLevel2Distance=2621440000
fCloudLevel1Distance=327680000
fCloudLevel0Distance=163840000
fCloudNearFadeDistance=90000000
[General]
iStoryManagerLoggingEvent=-1
bEnableStoryManagerLogging=0
[Trees]
bRenderSkinnedTrees=1
uiMaxSkinnedTreesToRender=40
[Display]
fShadowBiasScale=01500
fInteriorShadowDistance=30000000
fShadowDistance=80000000
iBlurDeferredShadowMask=3
bFloatPointRenderTarget=1
iShadowMaskQuarter=4
iShadowMapResolution=4096
bFXAAEnabled=1
iMaxAnisotropy=2
fGamma=06000
iShadowFilter=3
fDecalLOD2=15000000
fDecalLOD1=10000000
fSpecularLODStartFade=20000000
fShadowLODStartFade=2000000
fLightLODStartFade=35000000
iTexMipMapMinimum=0
iTexMipMapSkip=0
bTransparencyMultisampling=0
iWaterMultiSamples=0
iMultiSample=2
iShadowMode=3
bTreesReceiveShadows=0
bDrawLandShadows=0
bDrawShadows=1
bFull Screen=1
iSize H=768
iSize W=1024
fLeafAnimDampenDistEnd=46000000
fLeafAnimDampenDistStart=36000000
fTreesMidLODSwitchDist=100000000000
fMeshLODFadePercentDefault=12000
fMeshLODFadeBoundDefault=2560000
fMeshLODLevel2FadeTreeDistance=20480000
fMeshLODLevel1FadeTreeDistance=28440000
fMeshLODLevel2FadeDist=100000000000
fMeshLODLevel1FadeDist=100000000000
iScreenShotIndex=1
bShadowMaskZPrepass=0
bMainZPrepass=0
iMaxSkinDecalsPerFrame=25
iMaxDecalsPerFrame=100
sD3DDevice="AMD Radeon HD 5500 Series"
iAdapter=0
iPresentInterval=1
[Imagespace]
bDoDepthOfField=1
iRadialBlurLevel=0
[Grass]
b30GrassVS=1
fGrassStartFadeDistance=35020000
fGrassMaxStartFadeDistance=70000000
fGrassMinStartFadeDistance=4000000
[Water]
iWaterReflectHeight=512
iWaterReflectWidth=512
bUseWaterDisplacements=1
bUseWaterRefractions=1
bUseWaterReflections=1
bUseWaterDepth=1
[MAIN]
fSkyCellRefFadeDistance=1500000000
bGamepadEnable=1
bCrosshairEnabled=1
fHUDOpacity=10000
bSaveOnPause=1
bSaveOnTravel=1
bSaveOnWait=1
bSaveOnRest=1
[GamePlay]
bShowFloatingQuestMarkers=1
bShowQuestMarkers=1
iDifficulty=5
[Interface]
bDialogueSubtitles=1
bGeneralSubtitles=1
bShowCompass=1
fMouseCursorSpeed=10000
[Controls]
fMouseHeadingSensitivity=00300
fGamepadHeadingSensitivity=19000
bAlwaysRunByDefault=1
bInvertYValues=0
bGamePadRumble=1
bUseKinect=0
[Particles]
iMaxDesired=750
[SaveGame]
fAutosaveEveryXMins=150000
[AudioMenu]
fAudioMasterVolume=10000
fVal7=10000
uID7=0
fVal6=10000
uID6=0
fVal5=10000
uID5=0
fVal4=10000
uID4=0
fVal3=00000
uID3=466532
fVal2=10000
uID2=554685
fVal1=00000
uID1=1007612
fVal0=10000
uID0=94881
[Clouds]
fCloudLevel2Distance=2621440000
fCloudLevel1Distance=327680000
fCloudLevel0Distance=163840000
fCloudNearFadeDistance=90000000
[General]
iStoryManagerLoggingEvent=-1
bEnableStoryManagerLogging=0
iNumBitsForFullySeen=124
uGridsToLoad=5
uInterior Cell Buffer=7
uExterior Cell Buffer=84
iNumHWThreads=4
iPreloadSizeLimit=209715200
bUseThreadedTempEffects=1
bUseThreadedParticleSystem=1
bUseThreadedBlood=1
bUseThreadedMorpher=1
bUseThreadedAI=1
bEnableBoundingVolumeOcclusion=1
[TerrainManager]
fTreeLoadDistance=125000000
fBlockMaximumDistance=750000000
fBlockLevel1Distance=250000000
fBlockLevel0Distance=150000000
fSplitDistanceMult=04000
bShowLODInEditor=0
[Trees]
bRenderSkinnedTrees=1
uiMaxSkinnedTreesToRender=40
[Decals]
uMaxDecals=1000
bDecals=1
bSkinnedDecals=1
uMaxSkinDecals=100
uMaxSkinDecalsPerActor=60
[LOD]
fLODFadeOutMultSkyCell=10000
fLODFadeOutMultObjects=49998
fLODFadeOutMultItems=29600
fLODFadeOutMultActors=52500
[BlurShaderHDR]
bDoHighDynamicRange=0
[BlurShader]
bUseBlurShader=0
[Launcher]
bShowAllResolutions=0
uLastAspectRatio=1
bEnableFileSelection=1
[Display]
fGamma=06800
sD3DDevice="AMD Radeon HD 5500 Series"
iTexMipMapSkip=0
bFXAAEnabled=0
fMeshLODLevel2FadeDist=30720000
fMeshLODLevel1FadeDist=40960000
fSpecularLODStartFade=5060000
fLightLODStartFade=9920000
fTreesMidLODSwitchDist=36000000
iShadowMapResolution=512
fShadowBiasScale=05000
iShadowMaskQuarter=4
iBlurDeferredShadowMask=0
fShadowDistance=20000000
iMaxDecalsPerFrame=100
iMaxSkinDecalsPerFrame=25
iAdapter=0
iSize W=1024
iSize H=768
iMultiSample=1
iMaxAnisotropy=1
iPresentInterval=0
bFull Screen=1
fInteriorShadowDistance=30000000
bFloatPointRenderTarget=1
iShadowFilter=3
fDecalLOD2=15000000
fDecalLOD1=10000000
fShadowLODStartFade=2000000
iTexMipMapMinimum=0
bTransparencyMultisampling=0
iWaterMultiSamples=0
iShadowMode=3
bTreesReceiveShadows=0
bDrawLandShadows=0
bDrawShadows=1
fLeafAnimDampenDistEnd=46000000
fLeafAnimDampenDistStart=36000000
fMeshLODFadePercentDefault=12000
fMeshLODFadeBoundDefault=2560000
fMeshLODLevel2FadeTreeDistance=20480000
fMeshLODLevel1FadeTreeDistance=28440000
iScreenShotIndex=211
bShadowMaskZPrepass=0
bMainZPrepass=0
bShadowsOnGrass=1
bDeferredShadows=1
iNPatches=1
iNPatchPOrder=1
iNPatchNOrder=1
[Audio]
iAudioCacheSize=4096
iMaxSizeForCachedSound=1024
[BackgroundLoad]
bBackgroundPathing=1
bUseMultiThreadedTrees=1
bUseMultiThreadedFaceGen=1
bBackgroundCellLoads=1
iBackgroundLoadExtraMax=800
iBackgroundLoadExtraMin=5
iBackgroundLoadMilliseconds=1
iBackgroundLoadExtraMinFPS=25
iBackgroundLoadTreeMilliseconds=3
bCloneModelsInBackground=1
iBackgroundLoadFaceMult=50
以上就是关于自定义 logback 日志过滤器全部的内容,包括:自定义 logback 日志过滤器、求上古卷轴5的修改能用mod的SkyrimPrefs文档全部内容复制、上古卷轴5天际等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)