Long said Ehrlich called him Friday to let him know that he was chosen from among three people recommended by the Washington County Judicial Nominating Commission.
The other two finalists were Gregory C. Bannon, a Hagerstown-based private attorney, and Daniel P. Dwyer, a court-appointed master who makes legal recommendations in family law cases.
"I'm glad the governor saw fit to appoint me. It was stiff competition," Long said.
State's attorney since 1982, Long was widely considered to be the front-runner for the job.
Long said he will have a learning curve when he takes the bench within the next 30 days.
"I hope to apply myself and just be the best representative of the judiciary that I can be," he said.
Long said he will miss the professional relationships he forged as state's attorney.
"It's an incredibly talented group of people. They do a wonderful job," he said.
Long said he'll probably find out later this week when his promotion to the bench becomes effective.
On Monday, he continued with his state's attorney's business. He was in court prosecuting probation violations and speeding ticket appeals.
"I've still got a pile of stuff on my desk," he said.
Because he's been state's attorney for so long, there will be times that people he previously prosecuted will come before him.
Spence, who worked in the state's attorney's office under Long in the 1980s, had the same potential conflict of interest.
Long may be asked to remove himself from hearing those cases, Spence said.
"There will probably be a few cases, but it will not be a major problem," he said.
Long's appointment leaves a vacancy at the helm of the state's attorney's office. Long was re-elected to a four-year term in 2002.
Under the Maryland Constitution, the Washington County Circuit judges will appoint someone to serve until the 2006 election.
Circuit Administrative Judge Frederick C. Wright III could not be reached for comment Monday.