How can I specify a specific log file to write to from a Sitecore Powershell script?











up vote
1
down vote

favorite












I have some scripts where I'd like to separate their log output from the standard Sitecore Powershell log (SPE.log).



Is there a parameter which I can use on Write-Log to output to a named log file?










share|improve this question




























    up vote
    1
    down vote

    favorite












    I have some scripts where I'd like to separate their log output from the standard Sitecore Powershell log (SPE.log).



    Is there a parameter which I can use on Write-Log to output to a named log file?










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have some scripts where I'd like to separate their log output from the standard Sitecore Powershell log (SPE.log).



      Is there a parameter which I can use on Write-Log to output to a named log file?










      share|improve this question















      I have some scripts where I'd like to separate their log output from the standard Sitecore Powershell log (SPE.log).



      Is there a parameter which I can use on Write-Log to output to a named log file?







      powershell-extensions






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      Pratik Wasnik

      319114




      319114










      asked yesterday









      James Walford

      500312




      500312






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          You cannot. It doesn't support anything like that.



          Here is a documentation of Write-Log cmldet.



          If you are interested you can see how it is implemented:




          • WriteLogCommand.cs

          • PowerShellLog.cs


          SPE jsut defines it own log4net appender, see configuration here Cognifide.PowerShell.config (serach for PowerShellExtensionsFileAppender)



          You would have to implement your own solution with dynamic appenders.



          This might give you an idea of where to start: How to add log4net appender in runtime?






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "664"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f15380%2fhow-can-i-specify-a-specific-log-file-to-write-to-from-a-sitecore-powershell-scr%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            5
            down vote



            accepted










            You cannot. It doesn't support anything like that.



            Here is a documentation of Write-Log cmldet.



            If you are interested you can see how it is implemented:




            • WriteLogCommand.cs

            • PowerShellLog.cs


            SPE jsut defines it own log4net appender, see configuration here Cognifide.PowerShell.config (serach for PowerShellExtensionsFileAppender)



            You would have to implement your own solution with dynamic appenders.



            This might give you an idea of where to start: How to add log4net appender in runtime?






            share|improve this answer

























              up vote
              5
              down vote



              accepted










              You cannot. It doesn't support anything like that.



              Here is a documentation of Write-Log cmldet.



              If you are interested you can see how it is implemented:




              • WriteLogCommand.cs

              • PowerShellLog.cs


              SPE jsut defines it own log4net appender, see configuration here Cognifide.PowerShell.config (serach for PowerShellExtensionsFileAppender)



              You would have to implement your own solution with dynamic appenders.



              This might give you an idea of where to start: How to add log4net appender in runtime?






              share|improve this answer























                up vote
                5
                down vote



                accepted







                up vote
                5
                down vote



                accepted






                You cannot. It doesn't support anything like that.



                Here is a documentation of Write-Log cmldet.



                If you are interested you can see how it is implemented:




                • WriteLogCommand.cs

                • PowerShellLog.cs


                SPE jsut defines it own log4net appender, see configuration here Cognifide.PowerShell.config (serach for PowerShellExtensionsFileAppender)



                You would have to implement your own solution with dynamic appenders.



                This might give you an idea of where to start: How to add log4net appender in runtime?






                share|improve this answer












                You cannot. It doesn't support anything like that.



                Here is a documentation of Write-Log cmldet.



                If you are interested you can see how it is implemented:




                • WriteLogCommand.cs

                • PowerShellLog.cs


                SPE jsut defines it own log4net appender, see configuration here Cognifide.PowerShell.config (serach for PowerShellExtensionsFileAppender)



                You would have to implement your own solution with dynamic appenders.



                This might give you an idea of where to start: How to add log4net appender in runtime?







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered yesterday









                Alan Płócieniak

                7,4141332




                7,4141332






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Sitecore Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f15380%2fhow-can-i-specify-a-specific-log-file-to-write-to-from-a-sitecore-powershell-scr%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Quarter-circle Tiles

                    build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

                    Mont Emei