2 // MessageLoggingElement.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2006 Novell, Inc. http://www.novell.com
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using System.Collections;
31 using System.Collections.Generic;
32 using System.Collections.ObjectModel;
33 using System.ComponentModel;
34 using System.Configuration;
36 using System.Net.Security;
37 using System.Reflection;
38 using System.Security.Cryptography.X509Certificates;
39 using System.Security.Principal;
40 using System.IdentityModel.Claims;
41 using System.IdentityModel.Policy;
42 using System.IdentityModel.Tokens;
43 using System.ServiceModel;
44 using System.ServiceModel.Channels;
45 using System.ServiceModel.Description;
46 using System.ServiceModel.Diagnostics;
47 using System.ServiceModel.Dispatcher;
48 using System.ServiceModel.MsmqIntegration;
49 using System.ServiceModel.PeerResolvers;
50 using System.ServiceModel.Security;
51 using System.Runtime.Serialization;
55 namespace System.ServiceModel.Configuration
58 public sealed partial class MessageLoggingElement
59 : ConfigurationElement
62 static ConfigurationPropertyCollection properties;
63 static ConfigurationProperty filters;
64 static ConfigurationProperty log_entire_message;
65 static ConfigurationProperty log_known_pii;
66 static ConfigurationProperty log_malformed_messages;
67 static ConfigurationProperty log_messages_at_service_level;
68 static ConfigurationProperty log_messages_at_transport_level;
69 static ConfigurationProperty max_messages_to_log;
70 static ConfigurationProperty max_size_of_message_to_log;
72 static MessageLoggingElement ()
74 properties = new ConfigurationPropertyCollection ();
75 filters = new ConfigurationProperty ("filters",
76 typeof (XPathMessageFilterElementCollection), null, null/* FIXME: get converter for XPathMessageFilterElementCollection*/, null,
77 ConfigurationPropertyOptions.None);
79 log_entire_message = new ConfigurationProperty ("logEntireMessage", typeof (bool), false, new BooleanConverter (), null, ConfigurationPropertyOptions.None);
81 log_known_pii = new ConfigurationProperty ("logKnownPii", typeof (bool), false, new BooleanConverter (), null, ConfigurationPropertyOptions.None);
83 log_malformed_messages = new ConfigurationProperty ("logMalformedMessages", typeof (bool), false, new BooleanConverter (), null, ConfigurationPropertyOptions.None);
85 log_messages_at_service_level = new ConfigurationProperty ("logMessagesAtServiceLevel", typeof (bool), false, new BooleanConverter (), null, ConfigurationPropertyOptions.None);
87 log_messages_at_transport_level = new ConfigurationProperty ("logMessagesAtTransportLevel", typeof (bool), false, new BooleanConverter (), null, ConfigurationPropertyOptions.None);
89 max_messages_to_log = new ConfigurationProperty ("maxMessagesToLog", typeof (int), "10000", null, null, ConfigurationPropertyOptions.None);
91 max_size_of_message_to_log = new ConfigurationProperty ("maxSizeOfMessageToLog", typeof (int), 262144, null, null, ConfigurationPropertyOptions.None);
93 properties.Add (filters);
94 properties.Add (log_entire_message);
95 properties.Add (log_known_pii);
96 properties.Add (log_malformed_messages);
97 properties.Add (log_messages_at_service_level);
98 properties.Add (log_messages_at_transport_level);
99 properties.Add (max_messages_to_log);
100 properties.Add (max_size_of_message_to_log);
103 public MessageLoggingElement ()
110 [ConfigurationProperty ("filters",
111 Options = ConfigurationPropertyOptions.None,
112 DefaultValue = null)]
113 public XPathMessageFilterElementCollection Filters {
114 get { return (XPathMessageFilterElementCollection) base [filters]; }
117 [ConfigurationProperty ("logEntireMessage",
118 Options = ConfigurationPropertyOptions.None,
119 DefaultValue = false)]
120 public bool LogEntireMessage {
121 get { return (bool) base [log_entire_message]; }
122 set { base [log_entire_message] = value; }
126 [ConfigurationProperty ("logKnownPii",
127 Options = ConfigurationPropertyOptions.None,
128 DefaultValue = false)]
129 public bool LogKnownPii {
130 get { return (bool) base [log_known_pii]; }
131 set { base [log_known_pii] = value; }
135 [ConfigurationProperty ("logMalformedMessages",
136 Options = ConfigurationPropertyOptions.None,
137 DefaultValue = false)]
138 public bool LogMalformedMessages {
139 get { return (bool) base [log_malformed_messages]; }
140 set { base [log_malformed_messages] = value; }
143 [ConfigurationProperty ("logMessagesAtServiceLevel",
144 Options = ConfigurationPropertyOptions.None,
145 DefaultValue = false)]
146 public bool LogMessagesAtServiceLevel {
147 get { return (bool) base [log_messages_at_service_level]; }
148 set { base [log_messages_at_service_level] = value; }
151 [ConfigurationProperty ("logMessagesAtTransportLevel",
152 Options = ConfigurationPropertyOptions.None,
153 DefaultValue = false)]
154 public bool LogMessagesAtTransportLevel {
155 get { return (bool) base [log_messages_at_transport_level]; }
156 set { base [log_messages_at_transport_level] = value; }
159 [IntegerValidator ( MinValue = -1,
160 MaxValue = int.MaxValue,
161 ExcludeRange = false)]
162 [ConfigurationProperty ("maxMessagesToLog",
163 Options = ConfigurationPropertyOptions.None,
164 DefaultValue = "10000")]
165 public int MaxMessagesToLog {
166 get { return (int) base [max_messages_to_log]; }
167 set { base [max_messages_to_log] = value; }
170 [IntegerValidator ( MinValue = -1,
171 MaxValue = int.MaxValue,
172 ExcludeRange = false)]
173 [ConfigurationProperty ("maxSizeOfMessageToLog",
174 Options = ConfigurationPropertyOptions.None,
175 DefaultValue = "262144")]
176 public int MaxSizeOfMessageToLog {
177 get { return (int) base [max_size_of_message_to_log]; }
178 set { base [max_size_of_message_to_log] = value; }
181 protected override ConfigurationPropertyCollection Properties {
182 get { return properties; }