Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Topshelf logging and hostfactory errors
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Keith Stenson  
View profile  
 More options Jun 15 2012, 5:18 am
From: Keith Stenson <ksten...@gmail.com>
Date: Fri, 15 Jun 2012 02:18:11 -0700 (PDT)
Local: Fri, Jun 15 2012 5:18 am
Subject: Topshelf logging and hostfactory errors

Hi Guys,

I'm trying to get Topshelf to log errors when it's trying to start up my
service. I have added the Log4NetIntergration assembly and I'm using this
host setup:

HostFactory.Run(x =>
            {

                x.Service<AcquireService>(s =>
                {
                    s.SetServiceName("AcquireService");
                    s.ConstructUsing(name =>
container.Resolve<AcquireService>());
                    s.WhenStarted(svc =>
                    {
                        logger.Debug("Starting host service");
                        svc.Start();
                        StartWCFService(container);
                        logger.Debug("Successfully started host service");
                    });
                    s.WhenStopped(svc => svc.Stop());
                });
                x.RunAsLocalSystem();
                x.SetDisplayName("Acquire.Service");
                x.SetServiceName("Acquire.Service");
                x.UseLog4Net("logging.config");
            });

How ever I'm not getting any logging from Topshelf. Also if there is an
un-handled exception when trying to start the service, Topshelf seems to be
swallowing exceptions. I did some digging and it seems to be this part of
the Topshelf code that's causing my problem:

From: public static class HostFactory.......

public static void Run(Action<HostConfigurator> configure)
{
try
{
New(configure)
.Run();

}

catch (Exception ex)
{
_log.Error("The service exited abnormally with an exception", ex);

}
}

For some reason the the logger instance is not writing via log4net. Also
should the host process swallow an exception like this? should throw after
it's logged the exception?

Thanks for any advice you can give!

Keith


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mario Pareja  
View profile  
 More options Jun 15 2012, 7:38 am
From: Mario Pareja <pareja.ma...@gmail.com>
Date: Fri, 15 Jun 2012 07:38:38 -0400
Local: Fri, Jun 15 2012 7:38 am
Subject: Re: [topshelf-discuss] Topshelf logging and hostfactory errors

Here's a quick shot in the dark: try passing empty string "" to UseLog4Net.

The official site REALLY needs to include how to enable logging. It is
extremely frustrating to try out for the first time (in a long time) and
not have it not give any form of feedback.

On 2012-06-15, at 5:59 AM, Keith Stenson <ksten...@gmail.n com> wrote:

Hi Guys,

I'm trying to get Topshelf to log errors when it's trying to start up my
service. I have added the Log4NetIntergration assembly and I'm using this
host setup:

HostFactory.Run(x =>
            {

                x.Service<AcquireService>(s =>
                {
                    s.SetServiceName("AcquireService");
                    s.ConstructUsing(name =>
container.Resolve<AcquireService>());
                    s.WhenStarted(svc =>
                    {
                        logger.Debug("Starting host service");
                        svc.Start();
                        StartWCFService(container);
                        logger.Debug("Successfully started host service");
                    });
                    s.WhenStopped(svc => svc.Stop());
                });
                x.RunAsLocalSystem();
                x.SetDisplayName("Acquire.Service");
                x.SetServiceName("Acquire.Service");
                x.UseLog4Net("logging.config");
            });

How ever I'm not getting any logging from Topshelf. Also if there is an
un-handled exception when trying to start the service, Topshelf seems to be
swallowing exceptions. I did some digging and it seems to be this part of
the Topshelf code that's causing my problem:

From: public static class HostFactory.......

public static void Run(Action<HostConfigurator> configure)
{
try
{
New(configure)
.Run();

}

catch (Exception ex)
{
_log.Error("The service exited abnormally with an exception", ex);

}
}

For some reason the the logger instance is not writing via log4net. Also
should the host process swallow an exception like this? should throw after
it's logged the exception?

Thanks for any advice you can give!

Keith


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dru Sellers  
View profile  
 More options Jun 15 2012, 8:14 am
From: Dru Sellers <d...@drusellers.com>
Date: Fri, 15 Jun 2012 07:14:24 -0500
Local: Fri, Jun 15 2012 8:14 am
Subject: Re: [topshelf-discuss] Topshelf logging and hostfactory errors

My apologies everyone,

When we switched over to the new logging I failed to update the docs. I
will do that today.

-d

On Fri, Jun 15, 2012 at 6:38 AM, Mario Pareja <pareja.ma...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mario Pareja  
View profile  
 More options Jun 15 2012, 8:25 am
From: Mario Pareja <pareja.ma...@gmail.com>
Date: Fri, 15 Jun 2012 08:25:51 -0400
Local: Fri, Jun 15 2012 8:25 am
Subject: Re: [topshelf-discuss] Topshelf logging and hostfactory errors

Hey Drew,

Is it possible to get the default trace logger to output to the console
when you're just running from the command line?

Thanks,

Mario

On 2012-06-15, at 8:14 AM, Dru Sellers <d...@drusellers.com> wrote:

My apologies everyone,

When we switched over to the new logging I failed to update the docs. I
will do that today.

-d

On Fri, Jun 15, 2012 at 6:38 AM, Mario Pareja <pareja.ma...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dru Sellers  
View profile  
 More options Jun 15 2012, 10:26 am
From: Dru Sellers <d...@drusellers.com>
Date: Fri, 15 Jun 2012 09:26:03 -0500
Local: Fri, Jun 15 2012 10:26 am
Subject: Re: [topshelf-discuss] Topshelf logging and hostfactory errors

how is this for docs on the logging?

http://topshelf-project.com/documentation/logging/

-d

On Fri, Jun 15, 2012 at 7:25 AM, Mario Pareja <pareja.ma...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dru Sellers  
View profile  
 More options Jun 15 2012, 10:46 am
From: Dru Sellers <d...@drusellers.com>
Date: Fri, 15 Jun 2012 09:46:22 -0500
Local: Fri, Jun 15 2012 10:46 am
Subject: Re: [topshelf-discuss] Topshelf logging and hostfactory errors

I would assume that we can get the TraceSource to go to the console, but I
have never used them.

@chris, any ideas?

-d


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mario Pareja  
View profile  
 More options Jun 15 2012, 10:47 am
From: Mario Pareja <pareja.ma...@gmail.com>
Date: Fri, 15 Jun 2012 10:47:06 -0400
Local: Fri, Jun 15 2012 10:47 am
Subject: Re: [topshelf-discuss] Topshelf logging and hostfactory errors

Much better. I think you'll save people hassles by including a logger
one-liner in the Getting Started code sample.  Just add "Logger.UseLogger(new
NLogLogger());" to the top of the HostFactory configuration example since
people will inevitably copy-and-edit that sample code and inevitably end up
frustrated because they don't see any output. (I suggested NLog since so
people don't need to think about XML files when they are just trying to
spike things out.)

Is there a way for others to contribute to the documentation?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dru Sellers  
View profile  
 More options Jun 15 2012, 10:48 am
From: Dru Sellers <d...@drusellers.com>
Date: Fri, 15 Jun 2012 09:48:24 -0500
Local: Fri, Jun 15 2012 10:48 am
Subject: Re: [topshelf-discuss] Topshelf logging and hostfactory errors

No, not with the current model. If I switch to the MT style docs then yes,
people can easily contribute. Probably the best reason to switch.

-d

On Fri, Jun 15, 2012 at 9:47 AM, Mario Pareja <pareja.ma...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Keith Stenson  
View profile  
 More options Jun 15 2012, 11:24 am
From: Keith Stenson <ksten...@gmail.com>
Date: Fri, 15 Jun 2012 08:24:37 -0700 (PDT)
Local: Fri, Jun 15 2012 11:24 am
Subject: Re: [topshelf-discuss] Topshelf logging and hostfactory errors

Hi Guys, thanks for your help on this. It's really appreciated!

Keith


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »