Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4122510
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:29:28+00:00 2026-05-20T23:29:28+00:00

I have a console MEF application which convert files. There are some classes for

  • 0

I have a console MEF application which convert files. There are some classes for logging warnings and errors, each in separate assembly. Every message, which I want to log, goes to LoggerProxy class and from it to all relevant loggers. I’m using strongly typed resource names, e.g. Message.NoFilesFound. Here is my problem – the strings for me must be in english or german, but messages for file owner must go in his language. It means that Message.NoFilesFound should be in german on console and in the log file, but e.g. italian in the mail for customer.

How can I setup the system for thist task?

Now I have:

class Main()
{
    Message.Culture = new CultureInfo("it");
    LoggerProxy.Write( Destination.Console|Destination.Customer, Message.NoFilesFound );
}

class LoggerProxy
{

    [ImportMany]
    Lazy<ILogger,ILoggerMetadata>[] Loggers { get; set; }

    public void Write( Destination dest, string msg )
    {
        foreach ( var logger in Loggers )
            if ( (logger.Metadata.Destination & dest ) != 0 )
                logger.Value.Write( msg );
    }
}

I would like to have the culture change in LoggerProxy.Write, but the parameter is already localized string.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:29:28+00:00Added an answer on May 20, 2026 at 11:29 pm

    I would like to say Log( Message.FileNotFound ) and have one line on console “Datei nicht gefunden”, same line in logfile, but in the mail for our customer in Italy “File non trovato”. We cannot read logfiles in italian, and not all customers can read messages in german/english. – Gabriel Gnatowski 2 mins ago

    You need to refactor the interfaces so that the Write method shown get’s the unlocalized message id (Message.NoFilesFound).

    Then there are two approaches. Either the Logger (logger) has a member that portrays the locale ID to be used by the logger, or will be able to autonomically translate the ID to a message (perhaps, no translation at all, when logging to a database, so you can view the log in your preferred language at a later time, or simply for compression purposes).

    I’m nog aware of any interpolation strings, but suspect you have them (“Fichier {0} non trouvé”, e.g.) so you’d need to be able to pass these as well. A params string[] is neat on the calling site (LoggerProxy.Write) but down the chain IEnumerable would be most versatile.

    I suppose all of this is rather superficial, but I think it answers the question at least as far as I got the question clear.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a console application that I didn't write. Is there some easy way
I have a console based application which pulls files from a database and outputs
In a C# console application, is there a smart way to have console output
I have a console application that require to use some code that need administrator
I have a console application. A class (let's say Worker) does some work in
I have console application in which I am doing sqldependency. My problem is when
I have console application. In that i have some process that fetch the data
I have console application in c. I want to convert into window application, kindly
I have a console application from which I create a window. I can render
I have a console application which is intended to just keep running until it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.