Index: /code/branches/output/src/libraries/core/Core.cc
===================================================================
--- /code/branches/output/src/libraries/core/Core.cc	(revision 8832)
+++ /code/branches/output/src/libraries/core/Core.cc	(revision 8833)
@@ -263,17 +263,17 @@
                                LogWriter::getInstance().configurableMaxLevel_)
             .description("The maximum level of output shown in the log file")
-            .callback(static_cast<BaseWriter*>(&LogWriter::getInstance()), &BaseWriter::changedConfigurableLevels);
-        SetConfigValueExternal(LogWriter::getInstance().configurableContextsMaxLevel_,
+            .callback(static_cast<BaseWriter*>(&LogWriter::getInstance()), &BaseWriter::changedConfigurableLevel);
+        SetConfigValueExternal(LogWriter::getInstance().configurableAdditionalContextsMaxLevel_,
                                LogWriter::getInstance().getConfigurableSectionName(),
-                               LogWriter::getInstance().getConfigurableContextsMaxLevelName(),
-                               LogWriter::getInstance().configurableContextsMaxLevel_)
+                               LogWriter::getInstance().getConfigurableAdditionalContextsMaxLevelName(),
+                               LogWriter::getInstance().configurableAdditionalContextsMaxLevel_)
             .description("The maximum level of output shown in the log file for additional contexts")
-            .callback(static_cast<BaseWriter*>(&LogWriter::getInstance()), &BaseWriter::changedConfigurableLevels);
-        SetConfigValueExternal(LogWriter::getInstance().configurableContexts_,
+            .callback(static_cast<BaseWriter*>(&LogWriter::getInstance()), &BaseWriter::changedConfigurableAdditionalContextsLevel);
+        SetConfigValueExternal(LogWriter::getInstance().configurableAdditionalContexts_,
                                LogWriter::getInstance().getConfigurableSectionName(),
-                               LogWriter::getInstance().getConfigurableContextsName(),
-                               LogWriter::getInstance().configurableContexts_)
+                               LogWriter::getInstance().getConfigurableAdditionalContextsName(),
+                               LogWriter::getInstance().configurableAdditionalContexts_)
             .description("Additional output contexts shown in the log file")
-            .callback(static_cast<BaseWriter*>(&LogWriter::getInstance()), &BaseWriter::changedConfigurableContexts);
+            .callback(static_cast<BaseWriter*>(&LogWriter::getInstance()), &BaseWriter::changedConfigurableAdditionalContexts);
 
         SetConfigValue(bDevMode_, PathConfig::buildDirectoryRun())
Index: /code/branches/output/src/libraries/core/command/Shell.cc
===================================================================
--- /code/branches/output/src/libraries/core/command/Shell.cc	(revision 8832)
+++ /code/branches/output/src/libraries/core/command/Shell.cc	(revision 8833)
@@ -123,17 +123,17 @@
                                this->configurableMaxLevel_)
             .description("The maximum level of output shown in the " + this->getName())
-            .callback(static_cast<BaseWriter*>(this), &BaseWriter::changedConfigurableLevels);
-        SetConfigValueExternal(this->configurableContextsMaxLevel_,
+            .callback(static_cast<BaseWriter*>(this), &BaseWriter::changedConfigurableLevel);
+        SetConfigValueExternal(this->configurableAdditionalContextsMaxLevel_,
                                this->getConfigurableSectionName(),
-                               this->getConfigurableContextsMaxLevelName(),
-                               this->configurableContextsMaxLevel_)
+                               this->getConfigurableAdditionalContextsMaxLevelName(),
+                               this->configurableAdditionalContextsMaxLevel_)
             .description("The maximum level of output shown in the " + this->getName() + " for additional contexts")
-            .callback(static_cast<BaseWriter*>(this), &BaseWriter::changedConfigurableLevels);
-        SetConfigValueExternal(this->configurableContexts_,
+            .callback(static_cast<BaseWriter*>(this), &BaseWriter::changedConfigurableAdditionalContextsLevel);
+        SetConfigValueExternal(this->configurableAdditionalContexts_,
                                this->getConfigurableSectionName(),
-                               this->getConfigurableContextsName(),
-                               this->configurableContexts_)
+                               this->getConfigurableAdditionalContextsName(),
+                               this->configurableAdditionalContexts_)
             .description("Additional output contexts shown in the " + this->getName())
-            .callback(static_cast<BaseWriter*>(this), &BaseWriter::changedConfigurableContexts);
+            .callback(static_cast<BaseWriter*>(this), &BaseWriter::changedConfigurableAdditionalContexts);
     }
 
Index: /code/branches/output/src/libraries/util/Output.h
===================================================================
--- /code/branches/output/src/libraries/util/Output.h	(revision 8832)
+++ /code/branches/output/src/libraries/util/Output.h	(revision 8833)
@@ -38,5 +38,5 @@
     using std::endl;
 
-    inline OutputStream& orxout(OutputLevel level = level::debug_output, OutputContext context = context::undefined())
+    inline OutputStream& orxout(OutputLevel level = level::debug_output, const OutputContextContainer& context = context::undefined())
     {
         static OutputStream stream;
Index: /code/branches/output/src/libraries/util/output/BaseWriter.cc
===================================================================
--- /code/branches/output/src/libraries/util/output/BaseWriter.cc	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/BaseWriter.cc	(revision 8833)
@@ -38,7 +38,12 @@
 
         this->configurableMaxLevel_ = level::none;
-        this->configurableContextsMaxLevel_ = level::verbose;
-        this->configurableContexts_.push_back("example");
-        this->changedConfigurableLevels();
+        this->configurableAdditionalContextsMaxLevel_ = level::verbose;
+        this->configurableAdditionalContexts_.push_back("example");
+
+        this->subcontextsCheckMask_ = context::none;
+
+        this->changedConfigurableLevel();
+        this->changedConfigurableAdditionalContextsLevel();
+        this->changedConfigurableAdditionalContexts();
     }
 
@@ -47,7 +52,7 @@
     }
 
-    void BaseWriter::output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines)
+    void BaseWriter::output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
     {
-        if (level <= this->configurableMaxLevel_ || (level <= this->configurableContextsMaxLevel_ && this->isAdditionalContext(context)))
+        if (((this->subcontextsCheckMask_ & context.mask) == 0) || (this->subcontexts_.find(context.sub_id) != this->subcontexts_.end()))
         {
             const std::string& prefix = OutputManager::getInstance().getDefaultPrefix(level, context);
@@ -62,25 +67,57 @@
     {
         this->configurableMaxLevel_ = max;
-        this->changedConfigurableLevels();
+        this->changedConfigurableLevel();
     }
 
-    void BaseWriter::changedConfigurableLevels()
+    void BaseWriter::setAdditionalContextsLevelMax(OutputLevel max)
     {
-        int max_level = std::max(this->configurableMaxLevel_, this->configurableContextsMaxLevel_);
-        OutputListener::setLevelMax(static_cast<OutputLevel>(max_level));
+        this->configurableAdditionalContextsMaxLevel_ = max;
+        this->changedConfigurableAdditionalContextsLevel();
     }
 
-    void BaseWriter::changedConfigurableContexts()
+    void BaseWriter::changedConfigurableLevel()
     {
-        this->configurableContextsSet_.clear();
-        for (size_t i = 0; i < this->configurableContexts_.size(); ++i)
-            this->configurableContextsSet_.insert(this->configurableContexts_[i]);
+        OutputListener::setLevelMax(static_cast<OutputLevel>(this->configurableMaxLevel_));
     }
 
-    bool BaseWriter::isAdditionalContext(OutputContext context) const
+    void BaseWriter::changedConfigurableAdditionalContextsLevel()
     {
-        const std::string& name = OutputManager::getInstance().getContextName(context);
-        std::set<std::string>::const_iterator it = this->configurableContextsSet_.find(name);
-        return (it != this->configurableContextsSet_.end());
+        OutputListener::setAdditionalContextsLevelMax(static_cast<OutputLevel>(this->configurableAdditionalContextsMaxLevel_));
+    }
+
+    void BaseWriter::changedConfigurableAdditionalContexts()
+    {
+        OutputContextMask context_mask = context::none;
+        this->subcontextsCheckMask_ = context::none;
+
+        this->subcontexts_.clear();
+        this->subcontexts_.insert(context::no_subcontext);
+
+        for (size_t i = 0; i < this->configurableAdditionalContexts_.size(); ++i)
+        {
+            const std::string& full_name = this->configurableAdditionalContexts_[i];
+
+            std::string name = full_name;
+            std::string subname;
+
+            size_t pos = full_name.find("::");
+            if (pos != std::string::npos)
+            {
+                name = full_name.substr(0, pos);
+                subname = full_name.substr(pos + 2);
+            }
+
+            const OutputContextContainer& container = OutputManager::getInstance().registerContext(name, subname);
+
+            context_mask |= container.mask;
+
+            if (container.sub_id != context::no_subcontext)
+            {
+                this->subcontexts_.insert(container.sub_id);
+                this->subcontextsCheckMask_ |= container.mask;
+            }
+        }
+
+        this->setAdditionalContextsMask(context_mask);
     }
 }
Index: /code/branches/output/src/libraries/util/output/BaseWriter.h
===================================================================
--- /code/branches/output/src/libraries/util/output/BaseWriter.h	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/BaseWriter.h	(revision 8833)
@@ -45,23 +45,25 @@
             virtual ~BaseWriter();
 
+            void setLevelMax(OutputLevel max);
+            void setAdditionalContextsLevelMax(OutputLevel max);
+
             const std::string& getName() const
                 { return this->name_; }
 
-            void setLevelMax(OutputLevel max);
-
             int configurableMaxLevel_;
             inline std::string getConfigurableMaxLevelName() const
-                { return "outputLevel" + this->name_; }
+                { return this->name_ + "Level"; }
 
-            int configurableContextsMaxLevel_;
-            inline std::string getConfigurableContextsMaxLevelName() const
-                { return "outputContextsLevel" + this->name_; }
+            int configurableAdditionalContextsMaxLevel_;
+            inline std::string getConfigurableAdditionalContextsMaxLevelName() const
+                { return this->name_ + "AdditionalContextsLevel"; }
 
-            std::vector<std::string> configurableContexts_;
-            inline std::string getConfigurableContextsName() const
-                { return "outputContexts" + this->name_; }
+            std::vector<std::string> configurableAdditionalContexts_;
+            inline std::string getConfigurableAdditionalContextsName() const
+                { return this->name_ + "AdditionalContexts"; }
 
-            void changedConfigurableLevels();
-            void changedConfigurableContexts();
+            void changedConfigurableLevel();
+            void changedConfigurableAdditionalContextsLevel();
+            void changedConfigurableAdditionalContexts();
 
             static inline std::string getConfigurableSectionName()
@@ -69,5 +71,5 @@
 
         protected:
-            virtual void output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines);
+            virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines);
 
         private:
@@ -77,8 +79,11 @@
             void setLevelMask(OutputLevel mask);
 
-            bool isAdditionalContext(OutputContext context) const;
+            void setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max);
+            void setAdditionalContextsLevelMask(OutputLevel mask);
 
             std::string name_;
-            std::set<std::string> configurableContextsSet_;
+
+            OutputContextMask subcontextsCheckMask_;
+            std::set<OutputContextSubID> subcontexts_;
     };
 }
Index: /code/branches/output/src/libraries/util/output/LogWriter.cc
===================================================================
--- /code/branches/output/src/libraries/util/output/LogWriter.cc	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/LogWriter.cc	(revision 8833)
@@ -30,4 +30,5 @@
 
 #include <ctime>
+#include <cstdlib>
 
 #include "OutputManager.h"
Index: /code/branches/output/src/libraries/util/output/MemoryWriter.cc
===================================================================
--- /code/branches/output/src/libraries/util/output/MemoryWriter.cc	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/MemoryWriter.cc	(revision 8833)
@@ -48,5 +48,5 @@
     }
 
-    void MemoryWriter::output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines)
+    void MemoryWriter::output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
     {
         this->messages_.push_back(Message(level, context, lines));
@@ -58,5 +58,5 @@
         {
             const Message& message = this->messages_[i];
-            listener->unfilteredOutput(message.level, message.context, message.lines);
+            listener->unfilteredOutput(message.level, *message.context, message.lines);
         }
     }
Index: /code/branches/output/src/libraries/util/output/MemoryWriter.h
===================================================================
--- /code/branches/output/src/libraries/util/output/MemoryWriter.h	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/MemoryWriter.h	(revision 8833)
@@ -39,9 +39,9 @@
         struct Message
         {
-            Message(OutputLevel level, OutputContext context, const std::vector<std::string>& lines)
-                : level(level), context(context), lines(lines) {}
+            Message(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
+                : level(level), context(&context), lines(lines) {}
 
             OutputLevel level;
-            OutputContext context;
+            const OutputContextContainer* context;
             std::vector<std::string> lines;
         };
@@ -54,5 +54,5 @@
 
         protected:
-            virtual void output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines);
+            virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines);
 
         private:
Index: /code/branches/output/src/libraries/util/output/OutputDefinitions.h
===================================================================
--- /code/branches/output/src/libraries/util/output/OutputDefinitions.h	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/OutputDefinitions.h	(revision 8833)
@@ -34,5 +34,8 @@
 
 #define REGISTER_OUTPUT_CONTEXT(name) \
-    OutputContext name() { static OutputContext context = registerContext(#name); return context; }
+    const OutputContextContainer& name() { static const OutputContextContainer& context = registerContext(#name); return context; }
+
+#define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
+    const OutputContextContainer& subname() { static const OutputContextContainer& context = registerContext(#name, #subname); return context; }
 
 namespace orxonox
@@ -63,13 +66,24 @@
     using namespace level;
 
-    typedef uint64_t OutputContext;
-    typedef OutputContext (OutputContextFunction)();
+    typedef uint64_t OutputContextMask;
+    typedef uint16_t OutputContextSubID;
 
-    extern _UtilExport OutputContext registerContext(const std::string& name);
+    struct OutputContextContainer
+    {
+        OutputContextMask mask;
+        OutputContextSubID sub_id;
+        std::string name;
+    };
+
+    typedef const OutputContextContainer& (OutputContextFunction)();
+
+    extern _UtilExport const OutputContextContainer& registerContext(const std::string& name, const std::string& subname = "");
 
     namespace context
     {
-        static const OutputContext all       = 0xFFFFFFFFFFFFFFFF;
-        static const OutputContext none      = 0x0000000000000000;
+        static const OutputContextMask all       = 0xFFFFFFFFFFFFFFFF;
+        static const OutputContextMask none      = 0x0000000000000000;
+
+        static const OutputContextSubID no_subcontext = 0;
 
         namespace
@@ -103,4 +117,50 @@
             REGISTER_OUTPUT_CONTEXT(triggers);
             REGISTER_OUTPUT_CONTEXT(docking);
+
+            namespace misc
+            {
+                REGISTER_OUTPUT_SUBCONTEXT(misc, testcontext1);
+                REGISTER_OUTPUT_SUBCONTEXT(misc, testcontext2);
+                REGISTER_OUTPUT_SUBCONTEXT(misc, testcontext3);
+                REGISTER_OUTPUT_SUBCONTEXT(misc, testcontext4);
+            }
+
+            REGISTER_OUTPUT_CONTEXT(c30);
+            REGISTER_OUTPUT_CONTEXT(c31);
+            REGISTER_OUTPUT_CONTEXT(c32);
+            REGISTER_OUTPUT_CONTEXT(c33);
+            REGISTER_OUTPUT_CONTEXT(c34);
+            REGISTER_OUTPUT_CONTEXT(c35);
+            REGISTER_OUTPUT_CONTEXT(c36);
+            REGISTER_OUTPUT_CONTEXT(c37);
+            REGISTER_OUTPUT_CONTEXT(c38);
+            REGISTER_OUTPUT_CONTEXT(c39);
+            REGISTER_OUTPUT_CONTEXT(c40);
+            REGISTER_OUTPUT_CONTEXT(c41);
+            REGISTER_OUTPUT_CONTEXT(c42);
+            REGISTER_OUTPUT_CONTEXT(c43);
+            REGISTER_OUTPUT_CONTEXT(c44);
+            REGISTER_OUTPUT_CONTEXT(c45);
+            REGISTER_OUTPUT_CONTEXT(c46);
+            REGISTER_OUTPUT_CONTEXT(c47);
+            REGISTER_OUTPUT_CONTEXT(c48);
+            REGISTER_OUTPUT_CONTEXT(c49);
+            REGISTER_OUTPUT_CONTEXT(c50);
+            REGISTER_OUTPUT_CONTEXT(c51);
+            REGISTER_OUTPUT_CONTEXT(c52);
+            REGISTER_OUTPUT_CONTEXT(c53);
+            REGISTER_OUTPUT_CONTEXT(c54);
+            REGISTER_OUTPUT_CONTEXT(c55);
+            REGISTER_OUTPUT_CONTEXT(c56);
+            REGISTER_OUTPUT_CONTEXT(c57);
+            REGISTER_OUTPUT_CONTEXT(c58);
+            REGISTER_OUTPUT_CONTEXT(c59);
+            REGISTER_OUTPUT_CONTEXT(c60);
+            REGISTER_OUTPUT_CONTEXT(c61);
+            REGISTER_OUTPUT_CONTEXT(c62);
+            REGISTER_OUTPUT_CONTEXT(c63);
+            REGISTER_OUTPUT_CONTEXT(c64);
+            REGISTER_OUTPUT_CONTEXT(c65);
+            REGISTER_OUTPUT_CONTEXT(c66);
         }
     }
Index: /code/branches/output/src/libraries/util/output/OutputListener.cc
===================================================================
--- /code/branches/output/src/libraries/util/output/OutputListener.cc	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/OutputListener.cc	(revision 8833)
@@ -36,5 +36,6 @@
     {
         this->levelMask_ = level::none;
-        this->contextMask_ = context::all;
+        this->additionalContextsLevelMask_ = level::none;
+        this->additionalContextsMask_ = context::none;
 
         OutputManager::getInstance().registerListener(this);
@@ -67,9 +68,30 @@
     }
 
-    void OutputListener::setContextMask(OutputContext mask)
+    void OutputListener::setAdditionalContextsLevelMax(OutputLevel max)
     {
-        this->contextMask_ = mask;
+        this->setAdditionalContextsLevelRange(static_cast<OutputLevel>(0x1), max);
+    }
 
-        OutputManager::getInstance().updateCombinedContextMask();
+    void OutputListener::setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max)
+    {
+        int mask = 0;
+        for (int level = min; level <= max; level = level << 1)
+            mask |= level;
+
+        this->setAdditionalContextsLevelMask(static_cast<OutputLevel>(mask));
+    }
+
+    void OutputListener::setAdditionalContextsLevelMask(OutputLevel mask)
+    {
+        this->additionalContextsLevelMask_ = mask;
+
+        OutputManager::getInstance().updateCombinedAdditionalContextsLevelMask();
+    }
+
+    void OutputListener::setAdditionalContextsMask(OutputContextMask mask)
+    {
+        this->additionalContextsMask_ = mask;
+
+        OutputManager::getInstance().updateCombinedAdditionalContextsMask();
     }
 }
Index: /code/branches/output/src/libraries/util/output/OutputListener.h
===================================================================
--- /code/branches/output/src/libraries/util/output/OutputListener.h	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/OutputListener.h	(revision 8833)
@@ -48,24 +48,32 @@
             void setLevelMask(OutputLevel mask);
 
+            void setAdditionalContextsLevelMax(OutputLevel max);
+            void setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max);
+            void setAdditionalContextsLevelMask(OutputLevel mask);
+
+            void setAdditionalContextsMask(OutputContextMask mask);
+
             inline OutputLevel getLevelMask() const
                 { return this->levelMask_; }
+            inline OutputLevel getAdditionalContextsLevelMask() const
+                { return this->additionalContextsLevelMask_; }
+            inline OutputContextMask getAdditionalContextsMask() const
+                { return this->additionalContextsMask_; }
 
-            void setContextMask(OutputContext mask);
+            inline bool acceptsOutput(OutputLevel level, const OutputContextContainer& context) const
+            {
+                return (this->levelMask_ & level) ||
+                       ((this->additionalContextsLevelMask_ & level) && (this->additionalContextsMask_ & context.mask)); }
 
-            inline OutputContext getContextMask() const
-                { return this->contextMask_; }
-
-            inline bool acceptsOutput(OutputLevel level, OutputContext context) const
-                { return ((this->levelMask_ & level) && (this->contextMask_ & context)); }
-
-            inline void unfilteredOutput(OutputLevel level, OutputContext context, const std::vector<std::string>& lines)
+            inline void unfilteredOutput(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
                 { if (this->acceptsOutput(level, context)) this->output(level, context, lines); }
 
         protected:
-            virtual void output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines) = 0;
+            virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines) = 0;
 
         private:
-            OutputLevel   levelMask_;
-            OutputContext contextMask_;
+            OutputLevel       levelMask_;
+            OutputLevel       additionalContextsLevelMask_;
+            OutputContextMask additionalContextsMask_;
     };
 }
Index: /code/branches/output/src/libraries/util/output/OutputManager.cc
===================================================================
--- /code/branches/output/src/libraries/util/output/OutputManager.cc	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/OutputManager.cc	(revision 8833)
@@ -32,4 +32,5 @@
 #include "ConsoleWriter.h"
 #include "LogWriter.h"
+#include "util/Output.h"
 #include "util/StringUtils.h"
 
@@ -39,5 +40,8 @@
     {
         this->combinedLevelMask_ = level::none;
-        this->combinedContextMask_ = 0;
+        this->combinedAdditionalContextsLevelMask_ = level::none;
+        this->combinedAdditionalContextsMask_ = context::none;
+
+        this->subcontextCounter_ = 0;
     }
 
@@ -63,5 +67,5 @@
     }
 
-    void OutputManager::pushMessage(OutputLevel level, OutputContext context, const std::string& message)
+    void OutputManager::pushMessage(OutputLevel level, const OutputContextContainer& context, const std::string& message)
     {
         std::vector<std::string> lines;
@@ -94,5 +98,6 @@
     {
         this->updateCombinedLevelMask();
-        this->updateCombinedContextMask();
+        this->updateCombinedAdditionalContextsLevelMask();
+        this->updateCombinedAdditionalContextsMask();
     }
 
@@ -105,29 +110,57 @@
     }
 
-    void OutputManager::updateCombinedContextMask()
+    void OutputManager::updateCombinedAdditionalContextsLevelMask()
     {
-        this->combinedContextMask_ = 0;
+        int mask = 0;
         for (size_t i = 0; i < this->listeners_.size(); ++i)
-            this->combinedContextMask_ |= this->listeners_[i]->getContextMask();
+            mask |= this->listeners_[i]->getAdditionalContextsLevelMask();
+        this->combinedAdditionalContextsLevelMask_ = static_cast<OutputLevel>(mask);
     }
 
-    OutputContext OutputManager::registerContext(const std::string& name)
+    void OutputManager::updateCombinedAdditionalContextsMask()
     {
-        boost::bimap<OutputContext, std::string>::right_map::iterator it = this->contexts_.right.find(name);
-        if (it == this->contexts_.right.end())
+        this->combinedAdditionalContextsMask_ = 0;
+        for (size_t i = 0; i < this->listeners_.size(); ++i)
+            this->combinedAdditionalContextsMask_ |= this->listeners_[i]->getAdditionalContextsMask();
+    }
+
+    const OutputContextContainer& OutputManager::registerContext(const std::string& name, const std::string& subname)
+    {
+        std::string full_name = name;
+        if (subname != "")
+            full_name += "::" + subname;
+
+        std::map<std::string, OutputContextContainer>::iterator it_container = this->contextContainers_.find(full_name);
+        if (it_container != this->contextContainers_.end())
+            return it_container->second;
+
+        OutputContextContainer container;
+        container.name = full_name;
+
+        std::map<std::string, OutputContextMask>::iterator it_mask = this->contextMasks_.find(name);
+        if (it_mask != this->contextMasks_.end())
         {
-            OutputContext context = 0x1 << this->contexts_.size();
-            this->contexts_.insert(boost::bimap<OutputContext, std::string>::value_type(context, name));
-            return context;
+            container.mask = it_mask->second;
         }
         else
         {
-            return it->second;
+            container.mask = static_cast<OutputContextMask>(0x1) << this->contextMasks_.size();
+            this->contextMasks_[name] = container.mask;
+
+            if (container.mask == 0)
+                orxout(internal_warning) << "More than " << sizeof(OutputContextMask) * 8 << " output contexts defined. Context '" << name << "' might not get filtered correctly" << endl;
         }
+
+        if (subname == "")
+            container.sub_id = context::no_subcontext;
+        else
+            container.sub_id = ++this->subcontextCounter_; // start with 1
+
+        return (this->contextContainers_[full_name] = container);
     }
 
-    OutputContext registerContext(const std::string& name)
+    const OutputContextContainer& registerContext(const std::string& name, const std::string& subname)
     {
-        return OutputManager::getInstance().registerContext(name);
+        return OutputManager::getInstance().registerContext(name, subname);
     }
 
@@ -154,56 +187,12 @@
     }
 
-    const std::string& OutputManager::getContextName(OutputContext context) const
+    std::string OutputManager::getDefaultPrefix(OutputLevel level, const OutputContextContainer& context) const
     {
-        if (context != context::undefined())
-        {
-            boost::bimap<OutputContext, std::string>::left_map::const_iterator it = this->contexts_.left.find(context);
-            if (it != this->contexts_.left.end())
-                return it->second;
-        }
-        return BLANKSTRING;
-    }
+        static OutputContextMask undefined_mask = context::undefined().mask;
 
-    OutputContext OutputManager::getContextValue(const std::string& name) const
-    {
-        boost::bimap<OutputContext, std::string>::right_map::const_iterator it = this->contexts_.right.find(name);
-        if (it != this->contexts_.right.end())
-            return it->second;
-        else
-            return context::none;
-    }
+        std::string prefix = this->getLevelName(level) + ": ";
+        if (context.mask != undefined_mask)
+            prefix += "[" + context.name + "] ";
 
-    std::string OutputManager::getComposedContextName(OutputContext context) const
-    {
-        std::string name;
-        size_t counter = 0;
-        for (OutputContext context_test = 0x1; context_test != 0x0; context_test = context_test << 1)
-        {
-            if (context & context_test)
-            {
-                boost::bimap<OutputContext, std::string>::left_map::const_iterator it = this->contexts_.left.find(context_test);
-                if (it != this->contexts_.left.end())
-                {
-                    if (counter)
-                        name += ", ";
-
-                    name += it->second;
-                    ++counter;
-                }
-            }
-        }
-        return name;
-    }
-
-    std::string OutputManager::getDefaultPrefix(OutputLevel level, OutputContext context) const
-    {
-        std::string prefix = this->getLevelName(level) + ": ";
-        if (context != context::undefined())
-        {
-            std::string context_name = this->getContextName(context);
-            if (context_name == "")
-                context_name = this->getComposedContextName(context);
-            prefix += "[" + context_name + "] ";
-        }
         return prefix;
     }
Index: /code/branches/output/src/libraries/util/output/OutputManager.h
===================================================================
--- /code/branches/output/src/libraries/util/output/OutputManager.h	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/OutputManager.h	(revision 8833)
@@ -33,5 +33,5 @@
 
 #include <vector>
-#include <boost/bimap.hpp>
+#include <map>
 
 #include "OutputDefinitions.h"
@@ -45,5 +45,5 @@
             static OutputManager& getInstanceAndCreateListeners();
 
-            void pushMessage(OutputLevel level, OutputContext context, const std::string& message);
+            void pushMessage(OutputLevel level, const OutputContextContainer& context, const std::string& message);
 
             void registerListener(OutputListener* listener);
@@ -52,22 +52,17 @@
             void updateMasks();
             void updateCombinedLevelMask();
-            void updateCombinedContextMask();
+            void updateCombinedAdditionalContextsLevelMask();
+            void updateCombinedAdditionalContextsMask();
 
-            inline OutputLevel getCombinedLevelMask() const
-                { return this->combinedLevelMask_; }
-            inline OutputContext getCombinedContextMask() const
-                { return this->combinedContextMask_; }
+            inline bool acceptsOutput(OutputLevel level, const OutputContextContainer& context) const
+            {
+                return (this->combinedLevelMask_ & level) ||
+                       ((this->combinedAdditionalContextsLevelMask_ & level) && (this->combinedAdditionalContextsMask_ & context.mask));
+            }
 
-            inline bool acceptsOutput(OutputLevel level, OutputContext context) const
-                { return ((this->combinedLevelMask_ & level) && (this->combinedContextMask_ & context)); }
-
-            OutputContext registerContext(const std::string& name);
+            const OutputContextContainer& registerContext(const std::string& name, const std::string& subname = "");
 
             const std::string& getLevelName(OutputLevel level) const;
-            const std::string& getContextName(OutputContext context) const;
-            OutputContext getContextValue(const std::string& name) const;
-
-            std::string getComposedContextName(OutputContext context) const;
-            std::string getDefaultPrefix(OutputLevel level, OutputContext context) const;
+            std::string getDefaultPrefix(OutputLevel level, const OutputContextContainer& context) const;
 
         private:
@@ -78,8 +73,11 @@
             std::vector<OutputListener*> listeners_;
 
-            OutputLevel   combinedLevelMask_;
-            OutputContext combinedContextMask_;
+            OutputLevel       combinedLevelMask_;
+            OutputLevel       combinedAdditionalContextsLevelMask_;
+            OutputContextMask combinedAdditionalContextsMask_;
 
-            boost::bimap<OutputContext, std::string> contexts_;
+            std::map<std::string, OutputContextMask> contextMasks_;
+            std::map<std::string, OutputContextContainer> contextContainers_;
+            OutputContextSubID subcontextCounter_;
     };
 }
Index: /code/branches/output/src/libraries/util/output/OutputStream.cc
===================================================================
--- /code/branches/output/src/libraries/util/output/OutputStream.cc	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/OutputStream.cc	(revision 8833)
@@ -38,5 +38,5 @@
     }
 
-    OutputStream::OutputStream(OutputLevel level, OutputContext context)
+    OutputStream::OutputStream(OutputLevel level, const OutputContextContainer& context)
     {
         this->setOutputAttributes(level, context);
@@ -45,12 +45,12 @@
     void OutputStream::sendMessage()
     {
-        OutputManager::getInstanceAndCreateListeners().pushMessage(this->level_, this->context_, this->str());
+        OutputManager::getInstanceAndCreateListeners().pushMessage(this->level_, *this->context_, this->str());
         this->str("");
     }
 
-    void OutputStream::setOutputAttributes(OutputLevel level, OutputContext context)
+    void OutputStream::setOutputAttributes(OutputLevel level, const OutputContextContainer& context)
     {
         this->level_ = level;
-        this->context_ = context;
+        this->context_ = &context;
 
         this->bAcceptsOutput_ = OutputManager::getInstanceAndCreateListeners().acceptsOutput(level, context);
Index: /code/branches/output/src/libraries/util/output/OutputStream.h
===================================================================
--- /code/branches/output/src/libraries/util/output/OutputStream.h	(revision 8832)
+++ /code/branches/output/src/libraries/util/output/OutputStream.h	(revision 8833)
@@ -44,7 +44,7 @@
         public:
             _UtilExport OutputStream();
-            _UtilExport OutputStream(OutputLevel level, OutputContext context);
+            _UtilExport OutputStream(OutputLevel level, const OutputContextContainer& context);
 
-            void _UtilExport setOutputAttributes(OutputLevel level, OutputContext context);
+            void _UtilExport setOutputAttributes(OutputLevel level, const OutputContextContainer& context);
 
             template <class T>
@@ -76,5 +76,5 @@
 
             OutputLevel level_;
-            OutputContext context_;
+            const OutputContextContainer* context_;
             bool bAcceptsOutput_;
     };
