小编roo*_*i n的帖子

如何使用log4net在AppData文件夹中创建文件

如何在appData文件夹中创建日志文件.路径为C:\ Users\MYNAME\AppData\Roaming\Project\My Project\Application.我的项目启动后,将在此路径硬编码的路径上创建项目文件夹.如何使用log4net将我的日志文件添加到此文件夹中?我在配置文件中进行了更改

<?xml version="1.0"?>
<configuration>
<configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
    <appender name="Console" type="log4net.Appender.ConsoleAppender">
        <layout type="log4net.Layout.PatternLayout">
            <!-- Pattern to output the caller's file name and line    number -->
            <conversionPattern value="%5level [%thread] (%file:%line) - %message%newline" />
        </layout>
    </appender>
    <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">

        <file value="${APPDATA}\\Roaming\\Project\\My Project\\Application\\Log.txt"/>
        <appendToFile value="true" />
        <maximumFileSize value="100KB" />
        <maxSizeRollBackups value="10" />
        <layout type="log4net.Layout.PatternLayout">            
            <conversionPattern value="%level %thread %logger - %message%newline" />
        </layout>
    </appender>
    <root>
        <level value="ALL" />
        <appender-ref ref="Console" />
        <appender-ref ref="RollingFile" />
    </root>
</log4net>
<startup>
    <supportedRuntime version="v4.0" …
Run Code Online (Sandbox Code Playgroud)

log4net app-config c#-4.0 log4net-configuration

14
推荐指数
1
解决办法
9627
查看次数

如何使用功能区xml将图像添加到按钮?

如何将自定义图像添加到选项卡和上下文菜单中的功能区按钮.

我尝试了添加图像到功能区按钮的链接,但没有运气:-(.我正在设计Excel的插件.我在标题中添加了这个.

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"  onLoad="Ribbon_Load"   loadImage="Ribbon_LoadImage"> 
    <button id="btn2d" keytip="L" screentip="2D Visualization" supertip="2D Part Visualization" label="2D" size="large"/>
    <contextMenu idMso="ContextMenuCell">
    <button id="btn1" label="my label"/>
    </customUI>
Run Code Online (Sandbox Code Playgroud)

代码段

public Bitmap Ribbon_LoadImage(IRibbonControl control)
    {
        switch (control.Id)
        {
            case "btn2": return new Bitmap(Properties.Resources.btn1);
            case "btn3": return new Bitmap(Properties.Resources.btn2);
            case "btn4": return new Bitmap(Properties.Resources.btn3);
            case "btn5": return new Bitmap(Properties.Resources.Filter);
            case "btnOpt6": return new Bitmap(Properties.Resources.Settings);
            case "btnInform7": return new Bitmap(Properties.Resources.Vis);
            case "btnHelpPage": return new Bitmap(Properties.Resources.Help);
        }
        return null;
    }
Run Code Online (Sandbox Code Playgroud)

请帮帮我.我正在使用.net 4.0 c#VSTO excel addin for Office 2010.

.net c# vsto ribbon

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

.net ×1

app-config ×1

c# ×1

c#-4.0 ×1

log4net ×1

log4net-configuration ×1

ribbon ×1

vsto ×1