Jeff Mitchell
Jeff Mitchell

Reputation: 1479

How to remove the stacktrace from the standard ServiceStack error respose

I'm just getting started with ServiceStack, and I'd like to find out if it's possible to remove the stacktrace from the standard error response.

I have tried shutting off debugmode without any luck:

public override void Configure(Funq.Container container)
{
    SetConfig(new EndpointHostConfig { DebugMode = false, });
}

Thanks a bunch!

Upvotes: 2

Views: 3155

Answers (2)

Boyko Karadzhov
Boyko Karadzhov

Reputation: 586

I was worried about the stack trace before and did some testing about it.

I found out that in the default case you don't need to set this option. If the project is built in Release then the stack trace is not in the response.

Upvotes: 1

mythz
mythz

Reputation: 143359

By default the configuration below only removes the StackTrace from being externally visible in your Web Service's response:

SetConfig(new EndpointHostConfig { DebugMode = false, });

I've tested this again and it works as expected.

To disable Logging all together you can set ServiceStack to use a NullLogFactory

LogManager.LogFactory = new NullLogFactory();

Alternatively you can control the granularity of all logging by creating your own ServiceStack.Logging adapter and setting it in the same way:

LogManager.LogFactory = new MyCustomLogFactory();

Upvotes: 4

Related Questions